Reputation: 679
I have an app which plays music from a local server
and opens music player
in the web browser
but when the user goes back to the Home activity
and launches Another activity
which plays a video on the browser, The video opens in a different tab of the browser, while music tab does not get closed.
Can I close an already opened browser tab when another tab opens? If not. Please suggest some workarounds.
Upvotes: 3
Views: 4109
Reputation: 402
it isn;t the good way to do so, if you are interested in this then the code would be like this
List<ActivityManager.RunningAppProcessInfo> list = servMng.getRunningAppProcesses();
if(list != null){
for(int i=0;i<list.size();++i){
if("com.android.browser".matches(list.get(i).processName)){
int pid = android.os.Process.getUidForName("com.android.browser");
android.os.Process.killProcess(pid);
}
}
}
Upvotes: 0
Reputation: 679
After lots of struglling ,i reached on conclusion,we cant handle the operation of other application without permission by owner of application,so i have found alternet solution using webview now its working.
Upvotes: 3