Android Importing exporting sqlite data - android

So my idea is that i want to make it easy for people to convert over to my android app from someone else's. It seems as though i can import data into my database, correct me if i'm wrong, from a file. However, how can i (or another app available on the market) retreive the data from an app so that they (the user) can move it?

As far as I understand, you want to extract data from an app and use it with you app, isn't it?
That depends os how the app has the data stored, and almost all apps have the data stored in a way that you can't access it if you app don't have permissions to access it, and if that app don't offers a way of getting the data, you will need root permissions to access it, and for that the device must be rooted.
All that assuming that the data is on the device. Right now there are apps that save the data on internet, so you have to connect to the server the app connects and, using the same credentials to log in that the original app does, log and retrieve the data, and for retrieving the data you will need to use the same calls that the original app does. This is not good because at anytime the server calls needed to login or retrieve data can change and your app will be broken.
In other words, is impossible to access other app data in a normal way if that app don't have an API for your app to retrieve data.
Also if the app have an option to export data, then the user can export the data to a file in a common format so your app can open it.

Related

Preserving SQLite db data on App Update/Reinstall Rollout Xamarin

I have Xamarin.Forms shared project that I am testing on Android phone currently.
The sqlite db is stored in System.Environment.SpecialFolder.Personal as of now.
I want to make sure that user input data stored in db is preserved:
1 upon each next upgrade I am planning for an app, as well as
2 In additional situation where user removes his app totally and makes a fresh install
(I guess these are two totally different situations, but I might be wrong)
I would like to know whether an update of an App via Google Play Store Update will overwrite db file too, therefore all data be lost? Or will the data be preserved?
What would be the option if a user wanted to preserve his/her data even after an app Uninstall/Reinstall?
In second case, I am considering manual/automatic backup of SpecialFolder.Personal db version in use and storing it as a separate file outside of the package using External_STORAGE permissions.
Then the user will be able to Import data from external db file copy into the one that comes in the package.
Also, how should the Import look like?
Can I simply replace the file with external one?
Any advice on this topic will be very appreciated.
An update from Google Play will not overwrite the db file
If a user uninstalls the application, he will want to delete everything related with the application. So my best solution is to have a synchronize method within your API so that, when the user installs again the application, it will fill the local DB with the requested data.

React-native: save data in device memory

I know about asyncStorage. That's not what i need. I want to save some data locally, so if app will be completely deleted and installed again, it should gain access to the stored data. AsyncStorage data being removed along with app itself.
I think you must use a FileSystem to save files in phone storage. Take a look at this library to handle files: https://github.com/johanneslumpe/react-native-fs. Hope it helps.
I dont think anything an app creates can exist after app deletion. If you think about it, why would you want disk space being used up by an app you deleted. Only option I can think of is storing in the cloud: Google Drive, DropBox, etc. or a server you run and user data connected to an account system.
My experience is with iOS, maybe Android has some option for what you want.

Import DataBase from another app

I am learning content provider. Now I can get the data base values from one app to another app using of Content provider. Now I want to get entire database from one app to another app.
Now my try is get the value form A app and store that in B app. But the problem is A app having more than 100 tables. So that I decided to get the entire database from A app to B app. Is it possible to get the database from A app and import to B app?
Thanks in Advance.
On an un-rooted device? No (sandbox). From the application level? No (sandbox again). From adb on an rooted device? Yes.
Any usecase that might need to utilize such functionality? I highly doubt it. Well, maybe if one lost his signing key and tries to rescue the live data from the old app within the new one. Or just trying to be evil by stealing data for blackmailing purposes.
But even if you manage the database, sometimes ContentProviders are more then just a layer around the database (see ContactProvider for example). So even if you have the tables they might be useless unless you also have the provider logic.

How to access other apps data for a backup application?

I'm very new to android developing, and I'm making a project in my university for an app that backs up every other application's data to cloud. So in order to do this, I have to access it. Is it possible? And is there a way to do this without rooting the device?
The app that you want to create as backup use content provider in that app for insert,add, create, delete the data.That app work like a database for you.
For second app fetch the data from the first app.
use this link.
http://developer.android.com/guide/topics/providers/content-provider-creating.html

Secure application data

Is is possible to restrict user, from accessing any application data, like SQLite db file, shared pref. file..etc. I have restricted it to certain level. But still, user can access these file, if he boots the device as root user, or super user.
What needs to be done, to restrict the user from accessing my secure application data?
I saw a blog on this somewhere (I'll get the link if I can find it), but basically, there's nothing you can do. The blog author says that whatever data you put on a user's device is now theirs, and if they want at it bad enough, they're going to get it. A root user has access to everything on the device. That's what rooting is supposed to do.
The only way to really protect your data is to pull it from a secured server and not cache it, which is the only way you should be doing it, if you want to keep something from your user.
Found the blog post, suitably titled, "It's the User's Data, Dammit."
http://commonsware.com/blog/2012/05/01/its-the-users-data-dammit.html
You should really subscribe to this guy's blog. He's got some good stuff on there. (No, I'm not plugging. I wish I could be this guy.)
If the phone is rooted there is little you can do to stop access to files stored on the device.
The best you can do is encrypt the data written to the file or the fields in the database using a key that the user has to enter every time they start the app.

Categories

Resources