-1

I am making an app and I used sqlite as database. But whenever I uninstall and reinstall my app, previous accounts which I have made before uninstalling the app doesn't exists.

I want to make it the way that if user creates account on it and then uninstall that app, then whenever he/she will reinstall it, his /her previous signup account should be existing.

Is there any way to do so ? Please share. Thanks!

  • For that u can use an External Database and store your Your data in it.! – Atif AbbAsi Jul 27 '17 at 05:13
  • 1
    The point of uninstalling an app is to get rid of it and its associated components this is what android does by default, an app's data like login credentials for you case are stored in a private location accesssible to the app only, you can attempt to store it in another location but that will leave the user's data vulnerable. In short there is no way of achieving what you want without compromising the user's security – AguThadeus Jul 27 '17 at 05:27

3 Answers3

1

I suggest to use API call and SharedPreference for storing a particular user account on his device IMEI Number.

Whenever user opens an app

First Check whether the user account is exit in local, If not then check by using API call based on device IMEI number, And even if server don't have the info about the provided IMEI number then allow to login into APP.

This will solve your problem permanently.

Mohammad nabil
  • 1,010
  • 2
  • 12
  • 23
0

When you uninstall an application from device all of the app data get deleted from android device. So it is not possible to fulfill your requirement.

If you not uninstall app means use shared preference for next auto sign up.Its will for your requirement.

ThunderDragon
  • 613
  • 3
  • 13
  • 31
sasikumar
  • 12,540
  • 3
  • 28
  • 48
0

When you uninstall your app, the entire data directory of the app is deleted. This includes databases, preferences, other files, caches etc. In your case there are two possible ways to suits your requirement.

1) After the installation check with your backend / service whether this device having any account created previously in the system and get the login done and store again to your SQlite database or Shared Preferences. Here you need to use the unique identifier (IMEI Number / UDID ) for the device as source to check it. First Check whether the user account is exit in local, If not then check by using API call based on device unique identifier

2) Create the SQlite database in SDcard rather creating the default one. You could try saving the database to the SD Card instead and reading from there Like this . However, you will now lose access to the database if the user changes the SD Card or mounts it to the computer pre honeycomb.

Another option would be to back it up to a server at regular intervals and restore the backup from there manually, or implement something like the Google BackupAgent, which will automatically backup data if the user configures his/her device to backup against the Google account to which it is registered.

If you're worried about your data being read by others, encrypt it using AES or some other encryption technique.

King of Masses
  • 18,405
  • 4
  • 60
  • 77