0

I'm working on an Android app where everything is stored locally. (There is no account registration system). If a user tapped the Clear data and Clear cache option under Settings > Applications > Manage Application the on boarding process will show up again because the local storage got reset.

What options do developers have to check if a user is really a first time user and didn't just reset or reinstalled the app?

Pankaj
  • 7,908
  • 6
  • 42
  • 65
Matt
  • 2,981
  • 5
  • 23
  • 33

3 Answers3

1

With server - Send a unique device id to the server and save its state.

Without server (in your case) - The only option for to save it after reinstall/clear cache is to add the permission to read/write sd card and hide it in the device where he wont delete it. I've hide it in data/data/my_package_name_backwords, be if i wouldnt do it backwords then the system deletes this folder when the user uninstall my app.

EE66
  • 4,601
  • 1
  • 17
  • 20
  • Great idea but how do you explain the extra permissions to the user? With Android M it will trigger the "grant permission dialog" for write SD as far as I know – Matt Jul 03 '15 at 11:28
  • That's up to your app. Try to create a feature that might need to use it or something like this. – EE66 Jul 03 '15 at 11:30
  • How are you doing it? Did you need the permissions anyway? – Matt Jul 03 '15 at 11:31
  • 1
    Well in my case that was a couple of years ago and I needed it anyway for a 3rd party library. U can try and use my excuse:) – EE66 Jul 03 '15 at 11:32
1

While I would advice against such an implementation, since users have the right to 'reset' the application and it is expected behavior to revisit the first launch screen, the following option would be feasible:

Use a web service and store the device id upon completing the first launch. When the application is launched, check if the device id is already present in the the database. For obtaining the device id, I would like to refer to this answer

Community
  • 1
  • 1
TmKVU
  • 2,910
  • 2
  • 16
  • 30
0

Dont allow the user to clear the application data via ManageActivity. Allow the user to delete the data only through the app.

If the user clears the Data being inside the app, next time the user launches the app, will create the credentials and store it locally!

If you want the user not to clear the data by clearing the cache then create a dummy Activity that inturn lanuches your MainActivity and in the manifest declare this tag!

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:manageSpaceActivity="com.urapp.DummyActivity"
        android:theme="@style/AppTheme" >
...
...
</application>

Thats it! Now, when the user tries to clear the data it will launch your MainActivity!

  • `Dont allow the user to clear the application data via ManageActivity` What do I need to my app manifest for that? – Matt Jul 03 '15 at 11:30