14 Ocak 2017 Cumartesi

FirebaseDatabase Sınıfı

Giriş
Şu satırı dahil ederiz.
import com.google.firebase.database.FirebaseDatabase;
Eğer security ayarlarında "public" seçili ise URL'yi bilen herkes veritabanına erişebilir.

getInstance metodu
Şöyle yaparız.
FirebaseDatabase db = FirebaseDatabase.getInstance();
getReference metodu
Şöyle yaparız.
DatabaseReference ref = db.getReference("Movie");
setPersistenceEnabled metodu
Açıklaması şöyle
public synchronized void setPersistenceEnabled (boolean isEnabled)
The Firebase Database client will cache synchronized data and keep track of all writes you've initiated while your application is running. It seamlessly handles intermittent network connections and re-sends write operations when the network connection is restored. However by default your write operations and cached data are only stored in-memory and will be lost when your app restarts. By setting this value to true, the data will be persisted to on-device (disk) storage and will thus be available again when the app is restarted (even when there is no network connectivity at that time). Note that this method must be called before creating your first Database reference and only needs to be called once per application.
Şöyle yaparız.
db.setPersistenceEnabled (true);

Hiç yorum yok:

Yorum Gönder