java - Killing foreground browser programmatically -
i developing android app launch server address in chrome/firefox. i'm successful in that. later in development, i'm required hear server notify me whether has browser crash or hang. when happen, need restart browser.
this did, when user press button:
intent = new intent("android.intent.action.main"); i.setcomponent(componentname.unflattenfromstring("com.android.chrome/com.android.chrome.main")); i.addcategory("android.intent.category.launcher"); i.setdata(uri.parse("http://stackoverflow.com/")); i.setflags(intent.flag_activity_new_task); startactivity(i);
** bring browser foreground, want restarted when hang.
how restart (close , start again) foreground browser launch app programmatically?
if running on activity can phone call recreate(); recreate whole activity restart server call. if running on service, can utilize stopself(); you'll have notify activity recreate it
java android
No comments:
Post a Comment