[Solved] How can i make the app work offline with Firebase database

[ad_1] Simply activate offline persistens as specified in the official documentation: Firebase applications work even if your app temporarily loses its network connection. You can enable disk persistence with just one line of code: FirebaseDatabase.getInstance().setPersistenceEnabled(true); [ad_2] solved How can i make the app work offline with Firebase database

[Solved] i want to retrieve current logged user data from firestore but this show error [duplicate]

[ad_1] Change your onCreate method code to : protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_account); email = (TextView)findViewById(R.id.email_txt); mAuth = FirebaseAuth.getInstance(); UserId = mAuth.getCurrentUser().getUid(); passwordtxt = (TextView)findViewById(R.id.pass_txt); mFirestore = FirebaseFirestore.getInstance(); mFirestore.collection(“Hospitals”).document(UserId).get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() { @Override public void onSuccess(DocumentSnapshot documentSnapshot) { String user_name = documentSnapshot.getString(“email”); String password = documentSnapshot.getString(“password”); email.setText(user_name); passwordtxt.setText(password); } }); } 5 [ad_2] solved … Read more

[Solved] How to resolve method getDownloadUrl() [duplicate]

[ad_1] Try this: filepath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() { @Override public void onSuccess(Uri uri) { //Do what you need to do with the URL } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // Handle any errors } }); 0 [ad_2] solved How to resolve method getDownloadUrl() [duplicate]

[Solved] How to get firebase generated unique id [closed]

[ad_1] Check your MyFirebaseInstanceIDService class there will be a method onTokenRefresh(). You will get refreshedToken in this method like below: public void onTokenRefresh() { // Get updated InstanceID token. String refreshedToken = FirebaseInstanceId.getInstance().getToken(); // TODO: Implement this method to send any registration to your app’s servers. sendRegistrationToServer(refreshedToken); } 1 [ad_2] solved How to get firebase … Read more

[Solved] how can i get the count of key , value pair in firebase? [closed]

[ad_1] you can count children this way. databaseRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot snap: dataSnapshot.getChildren()) { Log.e(snap.getKey(),snap.getChildrenCount() + “”); } } @Override public void onCancelled(DatabaseError databaseError) { } }); 1 [ad_2] solved how can i get the count of key , value pair in firebase? [closed]

[Solved] save text message in Shared Preferences [duplicate]

[ad_1] I don’t see why you would like to do that, but sure. If saving to SharedPrefs is all you want, it’s quite straight forward SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString(“yourMessageKey”, message); editor.commit(); And of course, to read it back you SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE); String message = sharedPref.getString(“yourMessageKey”, defaultValue); 2 [ad_2] … Read more

[Solved] To store gps location in firebase real time database

[ad_1] You can send the location to Firebase by using the Firebase Database and DatabaseReference classes. First you have to make sure that you have these SDK’s in build.gradle: implementation ‘com.google.firebase:firebase-storage:16.0.4’ implementation ‘com.google.firebase:firebase-database:16.0.4’ Also, make sure that you have set up your Realtime Database in the Firebase Console. It would be best if you choose … Read more

[Solved] How to get a specific given in Firebase [closed]

[ad_1] First of all initiate the database instance FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance(); get the reference of your DB where you want to perform the operation DatabaseReference dbRef = firebaseDatabase.getReference(NAME_OF_DATABASE); then use this to get all the user with the name equal to the editText text Query query = profileDbRef .orderByChild(“name”) .equalTo(edittext.getText().toString()); query.addValueEventListener(new ValueEventListener() { @Override … Read more

[Solved] How to login using username instead email on Firebase in Android application [duplicate]

[ad_1] If you want to do something like giving special login access like usernames and passwords, you can use Firebase realtime database to do so. You can create a node named credentials and then store every new username and password in it. Then to check if a person is logging in with correct details, you … Read more

[Solved] Retriving data from Firebase in Arraylist in Android [closed]

[ad_1] Assuming you have a model class for your electrician object named Electrician, to get a list of electrician objects, please use the following code: DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference(); DatabaseReference electricianRef = rootRef.child(“Employee”).child(“Electrician”); ValueEventListener valueEventListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { List<Electrician> list = new ArrayList<>(); for(DataSnapshot ds : dataSnapshot.getChildren()) { … Read more

[Solved] android firebase unable to instantiate abstract class when call getValue() in listener

[ad_1] Your concrete Outfit class has fields and properties that define Item: public class Outfit implements Parcelable{ private List<Item> itemList = new ArrayList<>(); … public List<Item> getItemList() This means that the Firebase SDK will try to instantiate an Item, which isn’t possible due to it being abstract. Most likely you want Firebase to instantiate the … Read more

[Solved] How to Sort Firebase data by date stored as Value

[ad_1] you should store the data in miliseconds, is not that hard, and then you can bring the data and parse it in Date , look at this snippet try{ HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(new HttpGet(“https://google.com/”)); StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_OK) { DateFormat df = new SimpleDateFormat(“EEE, d … Read more