Resuming the main app after downloading APK expansion?

I am currently working on publishing a Cocos2d-x app on google play and since the file size is larger than 50MB, I have to use the APK expansion file.

I refer to this page and the sample given at http://developer.android.com/google/play/expansion-files.html

Currently, everything works fine.
My problem is that when it finishes downloading the expansion file and verified the file, clicking the OK button will close the app.

I just wondering, how can I resume my main app after clicking OK?
Reopening the app again will run the game perfectly since the expansion file has been downloaded.

But, I would like it to resume the main app right away after downloading the expansion. I hope somebody can help me.

http://stackoverflow.com/questions/6609414/howto-programatically-restart-android-app

or

public void restart(int delay) {
PendingIntent intent = PendingIntent.getActivity(this.getBaseContext(), 0, new Intent(getIntent()), getIntent().getFlags());
AlarmManager manager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
manager.set(AlarmManager.RTC, System.currentTimeMillis() + delay, intent);
System.exit(2);
}

where should I call restart? when clicking the OK button?
so instead of closing app, I just call that restart function?

one thing that I don’t understand is the app will restart and then close again?
I don’t quite sure what System.exit(2); is for?

This function will close the app, and restart after specified delay; You can restart after you have loaded your extension fully. Note I have not tested the code.

yup, it works thanks :slight_smile:
here’s another reference I refer to http://iserveandroid.blogspot.com/2011/03/how-to-launch-pending-intent.html

Great glad to hear that;