When is a SQLite Database for an Android application deleted? - android

I do web dev, and the information in the database is removed if I do it myself, but what about with Android? Will that information be deleted if I was to perform a factory reset on the phone? Is the only way to delete the database is ny removing the app from the phone?

Will that information be deleted if I was to perform a factory reset on the phone?
If the database is in its normal spot (internal storage), then a factory reset should prevent further access to the data. Somebody with sufficient forensic tools can probably still get at it, though, unless the user had their device set up with full-disk encryption.
Is the only way to delete the database is ny removing the app from the phone?
You, as a developer, can delete the database by calling deleteDatabase().
The user can also click the "Clear Data" button on your app's page in Settings. This is uncommon but can happen. From the standpoint of your app, the result is very similar to what you would see if the user uninstalled and reinstalled your app.

Related

Cordova - Permanent storage even after uninstall

I am developing an app using cordova (currently only releasing on Android) and I am struggling with storage options.
I am currently using Local Storage which seems to work well, however all data/values are wiped if the user uninstalls and reinstalls the app. I was wondering if there is a plugin or some way to permanently store data on Android even if the user uninstalls the app?
The reason I would like this is to allow the user to keep the coins they have earned/purchased if they were to remove the app and then get it back at a later date? I also have an 'ad free' IAP and I am currently storing a value in Local Storage when the user purchases this so don't want the ads to come back if they uninstall/reinstall.
If this is not possible is there an alternative way to recognise if the user has purchased the Ad Free IAP so they will always have no ads?
You could use cordova-plugin-cloud-settings to persist key/value data between installs / across same-platform devices.
You can save user data online. Check Firebase
Fetch the data from the server when needed.
Or you can also write it on a file and save it on local storage (not a good idea for most of the time)
This is terrible practice. You should always keep server side the amount of earned/purchased items then fetch them as you start the app. It wouldn't be too hard to download and rebuild your app in debug mode then change the local storage.

How to detect, if Android App was already installed at the device?

Is it possible to save some information at the device, if user deletes the application from his device? Something like a key-value (f.e. ("app id","date of installation")) which will not be removed?
Background: we are working on an application, which has an anonymous user for "exploring the app". This user should be removed, if user logs in. We can cover all cases, but not if user deletes the whole application. In iOS you can achieve this, by saving some values in the iOS-Keychain.
Any ideas or workarounds are welcome!
You have to save the data to some external file. So when you want to get the data you can read the data based on the file path.
Is it possible to save some information at the device, if user deletes the application from his device?
You can put stuff out on external storage in a place that will not be automatically deleted when your app is uninstalled (e.g., one of the roots supplied by Environment). However, the user can delete that file whenever the user wants.
Beyond that, there are no options, specifically so apps do not leave cruft behind that builds up and clutters up the user's device.
we are working on an application, which has an anonymous user for "exploring the app". This user should be removed, if user logs in.
It is unclear what this has to do with your original question.

Reclaim User History Android

How to check if the app is a fresh installation or a re installation. I want the user to have his history downloaded if its a re-installation like whats app. I thought of writing the user id in the shared preference but that is not possible as the data may get erased once the app is uninstalled. I am already having a folder of my app on the device which is used for image caching and downloading new images, but this is not reliable as the user may delete the folder. What else can I try ???
Obtain the user storage with getExternStorage, then leave a file there that specifies the usage history. The file you save there will survive uninstalls and reinstalls. Of course the user can delete that file but generally they will not, and if you name it properly they will realize it is part of a program.
I'd suggest you integrate with Android's Backup Service.
People switch phone every two years. Some factory reset their device. Some have more than one device. And some share their device with their kids. Linking a user history so that it follows a particular google account is the ideal way to go.
As to your question regarding Facebook integration, I'm afraid I know too little about that topic to be of any help.

How to Manage Offline Trial Expiration for an Android Application?

I have developed an application that I want to share with my clients. I want to share its trial, taking care of following points
Application should expire (i.e. User cannot move from main activity) after 30 Days
Internet connection is not required for my application so I don't want to manage trial expiration by managing a server where device's IMEI can be stored or sort of thing.
I want to restrict user from using application even if he uninstall and later on re-Install my app.
I want to protect application trial against a manual date changing hack normally applied by users
I was planning to maintain a file for my application with time token of first run saved in it which can be compared with GPS time on each run but the issue I am facing here is of file storage. If I save a file in Internal memory it gets deleted with application un-install and cannot be used when user reinstalls the app and if I store it on SD card/ External memory it is vulnerable to user deletion. I have investigated this issue from everywhere I can but got no success. Any idea or suggestion by you guys would be a relief. :-)
There will have internet access when the app is installed, or they wouldn't be able to install it.
Simply require that the user activate the app with a server the first time they use it. The app gets a "this app was first activated on yyyy-mm-dd" response from the server, and stores that info on a file in internal storage. From that point on, the user won't need to be on-line to use the app.

Can I store data on an Android device to persist between installs?

I want to store a small amount of data in a way where it persists between application installs. I obviously can't use SharedPreferences as they are removes upon uninstallation. Is there any way to store data so it survives a reinstall of the app?
The data I want to store is a unique ID, to allow blocking of users of the app if they misbehave. If I cannot store an ID, can I access the Google account(s) email addresses to use them as an indicator?
This blog post makes it clear none of the IDs the OS produces are any good, especially when considering tablets
Android: Identifying app installations
You can store the data in shared preferences and use a backup manager to have them backed up automatically. They should be restored once the app is reinstalled.
There is no real way of blocking the app for certain persons. You could fore all your users to create an account to use the app and block the accounts but they always can recreate an account. You could store something on the SD-Card and check for it but malicious users can find that and delete it. You could try to get the user to authenticate themselves with their google account against your app (andlytics is using an authentication method like that) but the user can factory reset his phone and create a new google account.
You have to choose how important the blocking of the users is and how much you want to annoy your other users because of some users that are not using your app as intended.
yes. you can store some data in the internal memory or the sd card.this can be done by creating(.somename)folder which is invisible to user and create a file.txt to store the data.
If the app is removed, the data is removed. You could put something on the SD card, but there's no reason to believe it would stay there. You might be able to work something through the application licensing mechanism. Details here

Categories

Resources