Generally application's OnCreate method is executed only once,
If the application is in a multi-process manner, the OnCreate method executes multiple times and initializes differently depending on the process name.
is to add a few more if else in the application
String processName = Osutils.getprocessname ( This, Android.os.Process.myPid ()); if(ProcessName! =NULL) { BooleanDefaultprocess =processname.equals (constants.real_package_name); if(defaultprocess) {initappformainprocess (); } Else if(Processname.contains (": WebBrowser")) ) {initappforwebbrowseprocess (); } Else if(Processname.contains (": Wallet"))) { } }
/** * @returnNULL may be returned if the specified process is not found*/ Public StaticString Getprocessname (Context cxt,intpid) {Activitymanager am=(Activitymanager) Cxt.getsystemservice (Context.activity_service); List<RunningAppProcessInfo> Runningapps =am.getrunningappprocesses (); if(Runningapps = =NULL) { return NULL; } for(Runningappprocessinfo procinfo:runningapps) {if(Procinfo.pid = =pid) { returnProcinfo.processname; } } return NULL; }
[Android Pro] OnCreate multiple call issues for global application in Android