views:

59

answers:

2

Hi,

Now I make a trial application. I'd like to store IMEI and other info in Android permanently. And I don't want to lose them after uninstalling it.

I tested with shared preference but it deletes after un-installation.

          SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
      SharedPreferences.Editor editor = settings.edit();
      editor.putBoolean("silentMode", true);                  

      // Commit the edits!
      editor.commit();

let me know where to store.

+1  A: 

SharedPreferences are removed together with the application. If you target the 2.2 platform, a new 'backup' API is added specifically for this purpose. Otherwise - you are stuck with storing the information on the SD Card.

Reflog
I target to Android 1.6. Actually I'd like to check IMEI and expiry date. Even if i save this info in SD Card, user can still use this expired application without SD Card, right?
That is correct. If you want to prevent that you'll have to store that info remotely on your server and query it using the IMEI when the application starts.
Reflog
+1  A: 

You can do it the way reflog wrote in his comment.

If you are accessing the imei have a remote web service that accepts the imei as an input and supplies your app with informations like trial expired, and stuff like that. In that way the user has to go through some efforts on every start to have the application running if it is expired. There are two problems with this approach

  • Your app wont run if the user has no internet connection. Even if your app does not need network you can't start the app without a data connectin.

  • Some users dislike the idea of their imei being send away to a remote server. The imei is a very private piece of data that identifies this user and could be used for all kind data analysis.

Janusz
If I store these info in Contacts.People or Contacts.Phones, what will be happened? Data in contacts is still stored after uninstalling.