Kotlin and Firebase read and write data
Try this code:
val database = Firebase.database
val reflatitude = database.getReference("/user/time/$currenttime/latitude")
reflatitude .addValueEventListener(object : ValueEventListener {
override fun onDataChange(dataSnapshot: DataSnapshot){
val latitude= dataSnapshot.getValue<Double>()
}
override fun onCancelled(error: DatabaseError) {
// Failed to read value
Log.w(TAG, "Failed to read value.", error.toException())
}
}
Unable to write data on realtime database of firebase using kotlin
I created another similar project and it worked out for me. I don't know the problem in my project but now my new project is working fine.
firestore read and write from another app android [Kotlin]
I have Solved this problem, now i want some suggestion
heres the code in Buyer App.
val option = FirebaseOptions.Builder()
.setProjectId("project-id-3564") //seller app project id
.setApiKey("Api_key")// api key of seller app project
.setApplicationId("1:1234567890")//app id for seller app project
.build()
val app = Firebase.initialize(this , option, "secondary")
val firebase = FirebaseFirestore.getInstance(app)
firebase.collection("collection").get().......
and also i have to change read write permission to the seller app project database rule
match /{document=**} {
allow read, write: if request.auth != null;
}
to this
match /{document=**} {
allow read, write: if true;
}
**
Again i got permission denied error
Which is not recomended.so Now what should i do about giving
permission
**
KOTLIN/FIREBASE Error when I try get data from firebase database - Client is offline
Ok, problem was with Firebase not my application. I don't know why but when I started app in every try Firebase closed my connection with database. I tried add to google.services.json some links to database and change some settings but this didn't work. After all I removed app from firebase and delete file google.services.json. I added app again on website then I connect app with firebase and new google.services.json was set. That's all everything is working thanks for help.
Related Topics
Debug Native Code in Android Library
Write_Secure_Settings Permission Error Even When Added in Manifest
Error:Please Fix the Version Conflict Either by Updating the Version of the Google-Services Plugin
Viewpager + Recyclerview Issue in Android
How to Change the Text of a Checkbox in Listview
How to Insert Image in a SQLite Database
Convert String into Localdatetime
Call to 'Getdrawingcache' Returns Null When Scroll Is Enabled
Getting "Caused By: Java.Lang.Verifyerror:"
How to Make My Own Custom Dialer in an Android Phone
Is Proguard.Cfg Needed for Library Projects
How to Show Dialog in Oncreate Method
How to Verify If User Has Network Access and Show a Pop-Up Alert When There Isn'T
Android 'Unable to Add Window -- Token Null Is Not for an Application' Exception
Connecting Android with Ms SQL Server 2008