Android: Open external app, close it and return to original -


i'm new android development, , creating app remote control use in test enviroment.

what i'm trying open app, in case netflix, wait x seconds , closing external app , return own app. open netflix i'm using url:

   intent browserintent = new intent(intent.action_view, uri.parse("https://www.netflix.com/watch/80015343?preventintent=false"));     browserintent.setflags(intent.flag_activity_new_task);     context.startactivity(browserintent); 

this in return opens media client app installed on device. though might able close netflix, , return own app, tried running through open processes following:

     for(activitymanager.runningappprocessinfo runningprocess : runningprocesses){                             system.out.println(runningprocess.processname);                              if(runningprocess.processname.equals(netflix_package_name))                             {                                 android.os.process.sendsignal(runningprocess.pid, android.os.process.signal_kill);                             }                         } 

unfortunately doesn't netflix app, shows app. later found out because of android 6.x.

i'm open recommendations - how in world close netflix media client, , return own app? @ moment i'm doing this:

     intent startmain = new intent(intent.action_main);                         startmain.addcategory(intent.category_home);                         startmain.setflags(intent.flag_activity_new_task);                         context.startactivity(startmain); 

this kinda stops netflix putting in background, of course don't end @ app. , can't restart app, since it's registered server. could, need deregister , register again. there must kind of smart way :-)

i hope guys can android-noob here :-)

best regards, ben


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -