I have a problem, I build an application for android that can open a single led with the use of bluetooth module and it succesfully works, now my problem is what if I want to open my led in my home while im at my office. What will I do is I will left another android that can open the led in my office and I will make another android application that will pass a data in my database and that data will retrieve by my android in my office and will trigger to open the LED.. I need tips on how I will gonna do that.. thanks
What you can do is have a realtime database like Firebase Realtime Database to store your data you need to communicate. So when a data is changed or updated your Phones will have the fresh data in sync. and then you can trigger changes accordingly
For eg, if the device in your office, clicks (Turn On LED), it will update the Firebase database with a value like (true), on the other side the device at your home would read the value, and check if the value is (true), then run the code to turn on the LED
Related
I am currently working on a project, this project is about an android application but it is currently on my friend's GitHub and it is currently connected to Firebase. I am not sure how to disconnect the project from Firebase. If someone could help that would be awesome. Please refer to this screenshot for further information:
Firebase Realtime Database is basically a Google program that hosts a database for you. In terms of being connected, generally we would be talking about a client connection to the host (the database). For that to happen you would have to be coding a program to connect to the database.
Are you talking about programmatically disconnecting the database? If not, I don't believe there's actually a connection there. It may just be Firebase telling you that you're on the right track to using the database in your program.
To double check that you aren't connected to the database, go in to your Firebase Console and double check that there isn't any usage happening on the Realtime Database. If there's not, I don't believe there's any connection you need to worry about.
Personally I've worked with Firebase before and used it in programs, and I've never come across a time when Firebase was anything other than a library or API for me to use. I doubt you need to worry!
If you're looking to delete the "App" on Firebase's end, you can go in to the Firebase Console and do that manually as well (to do this, you can go into your Apps card in the Firebase Console and select "Remove this app").
Furthermore, to delete the project itself in the Firebase Console, you can go to General Settings and click "Delete project".
Okay, so I am building an app that will go on the play store, it has the facility to add data to the Firebase (it cannot read it).
Second app will remain with me, (it wont go on the play store) and it is used to read the data.
Now what I did was, lets say the first app has package name : com.example.write and the second has com.example.read.
So I went to Firebase, created a project, added an application using the package name com.example.write and setup my first app. Working perfectly, I could add data to the Firebase database, now to create the second app, I created the android studio project, using the package name com.example.read and as both the apps use the same Firebase database, I added the new app in the same project in firebase, with package name com.example.read but then what I noticed was the previous database was deleted and when I hit the database button on the navigation bar, it gives me an option to create a database, when I do so, the first app crashes (probably because the old database was deleted to it could not add the data properly). So what should i do to use the same database on both the apps?
Using spark (free) plan of firebase!
So what should i do to use the same database on both the apps ?
To solve this, open Firebase Console, select your project, then click on Add another app and select Add Firebase to your Android app.
Provide all the necessary details for the new package name, in your case com.example.read, then download the JSON file again and add it to both of your android apps that are connected to this project. That's it!
So I got a simple app with a sqli database,
the app just shows the content which is saved in the database.
So if I am correct the sqli database is saved inside the app (apk),
what I am questioning myself is if I do have repeatedly upload the app / apk if I change, delete or add something in the database.
If yes is there a way around this, to like get the data from a database without repeatedly uploading the application if data has changed.
Yes, if you change something in the database you need to upload the apk, because the database is inside the apk. The alternative would be to put the database on a server. Then you would write a back end for your app in your language of choice, and this code would access the database. You could also use a Back End As a Service. Google BAAS to get info on the available options.
I'm writing an Android app using the phone number as the ID. I am getting all the contacts from the client's phone. I want to display to the user all of his contacts whom installed the app (just like whatsapp).
I was thinking about sending to the server all of the contacts and execute a search for each one of them to check if they exist in the db, and send back all the registered players. I am afraid this implementation will slow my app since I have to load all of his friends on every loading page (in case of new contacts that installed the app, or deleted and so on)
What are your thoughts about it?
Use a contacts cache and invalidate/recreate it whenever the contacts DB change, use code such as how to listen for changes in Contact Database. That should make your suggested approach fast enough.
Cheers.
I'm new to android sync so I really need ideas to get started. Actually my app's requirement is like this: My app needs to connect to my database online. But my android app can be used offline meaning, the user can add records to a local db, say sqlite. And then when the user connects to the Internet, the app should automatically connect to the server and add the record the user added when he is not online. Can you give me some considerations and ideas on how to do this? I really need your help guys. Thanks.
I will recommend you to go for Sync Adapter. See these links
AbstractThreadedSyncAdapter and Creating Sync Adapter.
I have used them long time ago. I will say that it is the best approach for syncing data between device and server. Usually, email apps use these sync adapters.
Sample is also given there. Download it if you want to go deep inside of "HOW".
Thank You!
You need to run background service like android alarm manager. You need to check that device is connected via internet or not. if device is connected via internet then sync the data to server.
Check this like to the way of data sync
How to sync SQLite database on Android phone with MySQL database on server?
Thanks