Domanda

Ora faccio una domanda di sperimentazione. Mi piacerebbe conservare IMEI ed altre informazioni in Android in modo permanente. E io non voglio perderli dopo averlo disinstallato.

ho provato con preferenza condivisa ma cancella dopo la disinstallazione.

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

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

fammi sapere dove memorizzare.

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top