Giriş
Şu satırı dahil ederiz.
getInstance metodu
Şöyle yaparız.
Şöyle yaparız.
Açıklaması şöyle
Şöyle yaparız.
Ş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 metoduAçı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.
db.setPersistenceEnabled (true);
Hiç yorum yok:
Yorum Gönder