I am working on an android application which requires a database to store the value from the app.
My requirement is that I need the database not be cleared when the clear data option in the app is done.
Anyone please suggest me the location where the database can be stored so that is not deleted when clear data option is used.
I assume you mean the "Clear Data" from the Preferences->Apps menu.
I recommend you review your reasons for preventing this.
Hitting "Clear Data" would allow the user to reset the application as when newly installed, which really means recover from possible application errors you haven't thought about.
You can store the data into mysql database and use server php to get data from android
Try this link
Does storing on SD Card works for you?
Related
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.
I want to give the user some point when they first install the app (but I want it to device specific). It means if he uninstalls and re-installs he will not get that point again. I have found below methods:
Keep device previous data in shared preferences which will be deleted if I release an updates of the app
Store previous data in sql database but if user clears data from settings it will be lost
Create a file in SDcard store data, saving that file in a folder with .foldername and check the file value, problem is that the user can delete it
Every time the user opens the app it sends device id to server, server will check it is previously stored or not before giving point. Problem is that server maintenance should be avoided.
Other than these 3 methods is there any other method?
Can you suggest me any other way,
or can you please tell me if there is no other method which would be better for 3 and 4?
Variation of 4.
using Google's backup servers, however the user can delete the data through his system settings.
I have created Sqlite database in app. when I clear data from settings->applications->manage applications the Sqlite db removed. any suggestions to keep sqlite database as it is.
When you press Clear Data from the Android application manager its supposed to remove everything related to the app such as preferences, databases, caches etc the only thing that gets left is the app so when you re-launch it behaves as if it was just installed.
If you want to allow the user to clear the data but keep the database then there should be an option in the menu that removes the shared preferences but doesn't do anything with the database.
Hope this helps.
Android's SQLite is intented for local app data storage. When you opt to wipe your app's data, this data is wiped (as expected).
If you want to persist DB data, look into external storage (eg. the late Parse.com, or MS's Azure). You'll be making network calls, your local data will still be wiped, and you'll need to have a way to link your app back up with the external data post-local-wipe (eg. logging in) but your external data will survive an app data clear.
The "linking up" part can be mitigated as well depending on your use case, eg. Google Play Games' data services is tied to your Google Play id and will resync after an app wipe.
Why would you want to keep the data when the user wants to clear everything.
It is not suggested you keep the db.
I would suggest you use the sd card to store images/text files with the adequate permission from the user.
Hi all: I need to know if there is any way to make Android persistent data that the user can not delete, because if I use SharedPreferences or databases, it is possible that the user can delete all data from the Android menu, Settings - > applications -> Manage Applications -> "application name" -> Clear Data.
If I keep in the external memory also exist the possibility that the user delete or change memory device.
As always, thank you very much and sorry for my English.
Please check out Swarm's Cloud Data system. It provides a system extremely simple API (very similar to SharedPreferences) for set/get operations. Everything is saved to the cloud, and persists per user account.
This is not possible, your application does not have access to such kind of functionality. The only option you have... is storing data into a remote server.
Store it on your cloud app server.
I agree, If you do not want your users to be able to erase your data, you need to store it outside of the device, and access it via the internet.
You can use your own server for this, alternatively, I have used the Skiller SDK for my multiplayer game and noticed that they provide a simple data storage functionality (which frankly, i didn't use) but it seems like it would answers your needs.
Good luck.
Hello I'm creating application for android no mater what kind but I need to store some information that information are so important because it's kind of result of registration and future settings for application, and now in managing application there is a button which can clear data, is there any way to disable it? I found some threads in internet where people writing that no it's impossible.
Or maybe if I'll use internal storage to save that information if the user will press "clear data" it'll also delete files in internal storage or not?
I can also use IMEI to identify phone user but what if the IMEI number will be unavailable?
I really need help any idea how I can do it?
go for sqlite database
you can use SqliteOpenHelper class for storing and retreving data