Can I set the ObjectId in Backendless manually - java

I use Parse.com for storing my data but since they will shut down their service I am going to use Backendless in the future.
I use it in my Android app for syncing my data between devices. Since the app can work offline I will use a SQLite DB to store the data and sync it to Backendless when online. And new data from Backendless will be stored in the SQLite DB as well to be available when working offline.
So when offline and creating a new record, I have to store it in SQLite until being online again. Now can I set the ObjectId, which is the identifier of Backendless objects, manually and will Backendless still get that is has not been saved to the cloud even already having an ObjectId set?

Even if the backend accepts an external objectId (and I think it doesn't), it's safer to just drop the local ObjectId before sending the objects to the backend, and let the backend generate a new one. This way, you won't have to manage several ID generators and worry about unicity.
If you can't change the local ObjectId, you can still delete and re-create the local object with the backend Id.

Related

How to use Room with multi FirestoreRecyclerAdapter?

I'm using 4 RecycleView in MainActivity which load data from Cloud Firestor using FirestoreRecyclerAdapter. Now I want to use Room to create receipt for the user in ReceiptActivity.
I did all staff, but there is something wrong when I try to delete and update item in Room. My app is crashing, so I'm asking if there is conflict with what I'm doing or not? If not,please guide me with best practice to do that. Thanks in advance.
Error message
When using Cloud Firestore, offline persistence:
For Android and iOS, offline persistence is enabled by default. To disable persistence, set the PersistenceEnabled option to false.
Which means that Firestore will create a local (internal) copy of your entire database on users device. So the same thing that you want to get can be also achieved without adding an extra local database because by default is one that already exists.
Furthermore, if you need to get the data from the cache only, you can achieve this with the help of the DocumentReference.get(Source source) and Query.get(Source source) methods.
By default, get() attempts to provide up-to-date data when possible by waiting for data from the server, but it may return cached data or fail if you are offline and the server cannot be reached. This behavior can be altered via the Source parameter.
So we can now pass as an argument to the DocumentReference or to the Query the source so we can force the retrieval of data from the server only, chache only or attempt server and fall back to the cache.

Firebase Android - Only need specific table to be in local device

I am using Firebase realtime database in my Android application. I have replica of database in local device using below line of code -
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
But it will sync all the tables between local and global database. I only want few table need to be sync not all.
Is there any way to only sync few tables in local memory and rest of table Android device will read from global database?
When you are using the following line of code:
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
All the data that the user recently received is cached to disk.
Is there any way to only sync a few tables in local memory and the rest of the table android device will read from the global database?
No, there is not! There is no way to exclude certain nodes from that disk persistence. Unfortunately, you cannot choose whether a node should be or shouldn't be cached on the disk. It's all or nothing.

Acces a PouchDB in android/java?

I am trying to fetch data from a PouchDB in Java for my Cordova app. I have made a backgroundservice in Java using this plugin. I use that for my cordova application to fetch some relevant data from my API. To get this data i need some information of the user, like the ID, which i have stored in my PouchDB in the JavaScript. Now i want to fetch this data in my BackgroundService.
I have tried:
SQLiteDatabase db = openOrCreateDatabase("Survalid",MODE_PRIVATE,null);
But i have been unable to find the right documentation of getting data from the database. Also since the SQLiteDatabase object is a class from android, i think it creates a new Database rather then opens the existing pouchdb.
Question in short:
Is it possible to open and fetch data from a PouchDB in Java, if so how?
Thanks in advance.
Check out sqlite plugin 2 and where is data stored which tells you how you can access the data from Java. Note, though, that you probably shouldn't modify this data, although you can read it if you want.

Sync SQLite DB on android studion with MySQL DB on web server

I am developing an android app that measures the radio interface parameters of a network periodically, stores the data in SQLite DB and transfers the data stored to MySQL DB on a web server. How can I make this possible?
I've done some research on this and found only one usable option, which is to make a web service using json or xml to pull/push data between the two databases. You could create a database link between the two, but this is not advisable.
There are numerous questions with a more detailed scope for this issue and you should be able to find one that fits your use case. If not, ask a new question after this research with more details and what you've done so far.

Parse.com: Deploy app with local DB

I use the Parse.com Cloud service in my Android app to sync data between devices.
I use the app mainly offline and use the local DB
Parse.enableLocalDatastore(getApplicationContext());
I want to deploy my app with a local DB that already contains a few thousand records. How can I do that? I don't want to sync the data on every device on first use.
Local datastore is not really a "local db", although you get some of the benefits a local db would give you. There is unfortunately no way to pre-populate the local datastore like you're after. The only way I can think of is to use another technology (like sqlite/core data etc) to store the pre-populated data. The problem is that to pin the data to the local datastore, you would need to get the PFObjects from Parse first anyway...
The Parse local datastore is not created to work as an offline database per se; only to offer an "offline mode" for your online data.

Categories

Resources