extends:http://johncookie.iteye.com/blog/1560649
A long time no update, change the company, in the mobile phone end of the online game, the technology is WEBAPP+PHONEGAP form, has always felt that the use of end-travel platform resources better, but also more fluent, but the form of phonegap can improve code reuse, the difference between the basic above. This time to find out, the form of page tour also has a benefit, is the update convenient, the game after the update does not need to reinstall the client, repack the release of new apps, which should be considered a good advantage.
The following section of code is used in the background to update the data file after the restart of the app code, personally think it is more practical, the reason is to use, because the original want to directly re-loadwebview, but an error occurred, the current WebView is already in the parent window, so that cannot be reused directly , and debugging is not smooth, and finally thought of the method of restarting the application directly, although the beginning or will go through the detection of updates, but because the update data has been completed, so will skip directly, and will not waste extra time and traffic.
Intent i = getbasecontext (). Getpackagemanager (). Getlaunchintentforpackage (Getbasecontext (). Getpackagename ()); I.addflags (intent.flag_activity_clear_top);
Pay particular attention to the setting of flag
Android Restart application code