Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

restart application programmatically android

Intent mStartActivity = new Intent(context, StartActivity.class);
int mPendingIntentId = 123456;
PendingIntent mPendingIntent = PendingIntent.getActivity(context, mPendingIntentId,    mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);
System.exit(0); //you can also kill your app's process
 
PREVIOUS NEXT
Tagged: #restart #application #programmatically #android
ADD COMMENT
Topic
Name
9+3 =