Skip to content Skip to sidebar Skip to footer

How Do I Tell The System To Do Setup() When My Android App Is Installed?

I would like to make an album and add some music files when my android app is first installed on a device. Is there a way is can do something like below? public void onInstall(){

Solution 1:

You can't do anything after the app is installed, only after it is run.

Just store a flag in your SharedPreferences to see whether or not it has done its first-time install process already and then perform it, or, if you're installing music files, check for their existence and install them if they're not there yet.

Solution 2:

There's no way to know when your app is installed... however, you can detect when it's first launched. It has been discussed a lot of times here. You just need to persist it using a shared preference.

Solution 3:

Post a Comment for "How Do I Tell The System To Do Setup() When My Android App Is Installed?"