1

I want to know how to check if an android default browser or any mobile browser is already running. Can I also check if my url (e.g."www.url.com") is accessed? Or can I get url?

thanks.

whoknows
  • 296
  • 1
  • 4
  • 18

2 Answers2

0

This is impossible. The android browser or any other browser (the user may have another default browser) does not emit any broadcast when an url is opened.

A possible solution is to write your own browser.

DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
0

I want to know how to check if an android default browser or any mobile browser is already running.

You can use ActivityManager to check which tasks are running. Example:

 ActivityManager actvityManager = (ActivityManager) youContext.getSystemService( ACTIVITY_SERVICE );
 List<RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses();
 for(int i = 0; i < procInfos.size(); i++)
 {
     if(procInfos.get(i).processName.equals("com.android.browser")) {
         Toast.makeText(getApplicationContext(), "Browser App is running", Toast.LENGTH_LONG).show();
     }
 }

You can have a list of the process names you want to check if they are running. For the above example i used the default Android Browser.

Source: https://stackoverflow.com/a/11391558/1482726

Can I also check if my url (e.g."www.url.com") is accessed? Or can I get url?

I do not think that is possible.

Community
  • 1
  • 1
AggelosK
  • 4,313
  • 2
  • 32
  • 37
  • I've read this answer before though not sure if I'm going to this but now, I'll try this one. Thanks. – whoknows Dec 11 '13 at 08:35