Is it possible to have interaction when updating my app?

1

How can I change sharedPreferences or add a folder when updating my app?

I have a C app I'm running on Android with the SDL library and whenever I do an app update the application files have to be updated too (they're in a system folder). The problem is that I do not know when an update has been made.

I know that when I start up the app I get it done, but it's still a hassle and there could be problems if the user does not open the app until the next update. If there was a way to do it during the installation was ideal and solved all the problems.

    
asked by anonymous 04.08.2016 / 18:49

1 answer

2

Not possible.

You'll have to wait for the next time the application is run and then do it.

The only possibility is to have a BroadcastReceiver in another package that responds to Intents ACTION_PACKAGE_ADDED and ACTION_PACKAGE_CHANGED and run an installed / updated application service that updates these files.

The onReceive() method of BradcastReceiver would look something like this:

public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();

    if (action.equals(Intent.ACTION_PACKAGE_ADDED)) {
        Uri data = intent.getData();
        String pkgName = data.getEncodedSchemeSpecificPart();
        if(pkgName.equals("nome da package"){
            //Executar serviço para terminar a instalação
        }
    }

    //Testar intent ACTION_PACKAGE_CHANGED
    ....
    ....
}

The problem is if this package is uninstalled ....

    
04.08.2016 / 21:53