Hi,
I decided to post this working example in the hopes that it can be useful to some people, and also maybe eventually someone will update it. I find database one of the most useful things in Firebase and maybe you do too. After getting frustrated with the almost working firebase realtime database, I put this patchwork together. Although it is not realtime, it does work normally. Anyways hope you like it.
This example allows you to login with facebook, and google, and post and get from the database.
This uses REST operations to post and put and get from the firebase db. You must be logged in to post. I know you can do anonymous login with authex, but it is not implemented here. I used @fredo s custom http and codes for the REST operations. THANKS FREDO!!
Before using this, you must integrate firebase, and implement facebook and/or google login. You will need atleast one of the two login methods working. Google is easier.
Firebase integration: https://www.b4x.com/android/forum/threads/integrating-firebase-services.67692/
Google login: https://www.b4x.com/android/forum/threads/firebaseauth-authenticate-your-users.67875/
Facebook integration: https://www.b4x.com/android/forum/threads/facebook-extends-firebaseauth-to-support-facebook.67954/
If you want to put to the DB instead of posting, then just change the button command to put instead of post, and it works.
One way to make it update similar to realtime is via notifications (ie. when a user posts something, he broadcasts notification too all users who then refresh their database), but notification is not implemented here.
****DONT DO THIS ON AN ACTIVE DB IF YOU DONT KNOW WHAT YOU ARE DOING. A PUT COMMAND CAN EASE ALL YOUR DATA. CREATE A NEW DB FOR YOURSELF, OR KNOW WHAT YOU ARE DOING***
*******************************************************
DOWNLOAD LINK:
https://www.dropbox.com/s/a9mqvj1dcaigjjw/Working Firebase Database example simple.zip?dl=0
The attached file in this thread does not work (b4x filesize limit I had to delete opt.jar and without it, it will not work). Please use the file in the link above.
Tags: rest, curl, resftul, firebase
Credit: Used code from @fredo example
I decided to post this working example in the hopes that it can be useful to some people, and also maybe eventually someone will update it. I find database one of the most useful things in Firebase and maybe you do too. After getting frustrated with the almost working firebase realtime database, I put this patchwork together. Although it is not realtime, it does work normally. Anyways hope you like it.
This example allows you to login with facebook, and google, and post and get from the database.
This uses REST operations to post and put and get from the firebase db. You must be logged in to post. I know you can do anonymous login with authex, but it is not implemented here. I used @fredo s custom http and codes for the REST operations. THANKS FREDO!!
Before using this, you must integrate firebase, and implement facebook and/or google login. You will need atleast one of the two login methods working. Google is easier.
Firebase integration: https://www.b4x.com/android/forum/threads/integrating-firebase-services.67692/
Google login: https://www.b4x.com/android/forum/threads/firebaseauth-authenticate-your-users.67875/
Facebook integration: https://www.b4x.com/android/forum/threads/facebook-extends-firebaseauth-to-support-facebook.67954/
If you want to put to the DB instead of posting, then just change the button command to put instead of post, and it works.
One way to make it update similar to realtime is via notifications (ie. when a user posts something, he broadcasts notification too all users who then refresh their database), but notification is not implemented here.
****DONT DO THIS ON AN ACTIVE DB IF YOU DONT KNOW WHAT YOU ARE DOING. A PUT COMMAND CAN EASE ALL YOUR DATA. CREATE A NEW DB FOR YOURSELF, OR KNOW WHAT YOU ARE DOING***
*******************************************************
DOWNLOAD LINK:
https://www.dropbox.com/s/a9mqvj1dcaigjjw/Working Firebase Database example simple.zip?dl=0
The attached file in this thread does not work (b4x filesize limit I had to delete opt.jar and without it, it will not work). Please use the file in the link above.
Tags: rest, curl, resftul, firebase
Credit: Used code from @fredo example
Attachments
Last edited: