Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:00:00+00:00 2026-06-08T17:00:00+00:00

Possible Duplicate: How can I check if an app running on Android? I would

  • 0

Possible Duplicate:
How can I check if an app running on Android?

I would like to know if there is a way to check if the Android default browser (browser in Android OS) has been opened. Suppose it’s opened, I would like a toast to be displayed. How can I do this programmatically?

This is the code that I used in the class that extends the Service class which listens to the logs and checks if the Android default browser has been opened. If it is then it prints a log in the LogCat stating that the Android default browser has been opened.

try {
    Process mLogcatProc = null;
    BufferedReader reader = null;
    mLogcatProc = Runtime.getRuntime().exec(new String[] { "logcat", "-d" });

    reader = new BufferedReader(new InputStreamReader(mLogcatProc.getInputStream()));

    String line;
    final StringBuilder log = new StringBuilder();
    String separator = System.getProperty("line.separator");

    while ((line = reader.readLine()) != null) {
        log.append(line);
        log.append(separator);
    }
    String w = log.toString();
    Log.d("LogService", "The log is: " + w);

    if (w.contains("Starting activity: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.android.browser/.BrowserActivity }")) {
        Log.d("LogService", "The browser has been opened");
    }

}
catch (Exception e) {
    Log.d("LogService", "The stacktrace is: " + e.getMessage());
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:00:02+00:00Added an answer on June 8, 2026 at 5:00 pm

    google said on the google IO that such a behavior is considered as malware .

    however , up until API 15 (including) , you can use a service that listens to the logs , and check if the desired app has started . that’s because each time you run an app , android writes to the log about it .

    this is considered as a workaround but a lot of apps use it and it works fine .

    not sure if on the new version (API 16) reading logs would be that simple . they said that the permission to read from logs won’t work anymore , and that they allow apps to read their own logs instead (without any permission needed) .

    of course , if the app you are trying to monitor gives any kind of API to tell the world (via intent for example) that it has started , you can use it . i don’t think that the built in web browser does that , though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to check network type in iPhone app I would like to
Possible Duplicate: Pythonic way to check if a file exists? How can Check if
Possible Duplicate: Developing an Android smartphone app - on which devices would YOU suggest
Possible Duplicate: Is there a way to check if a var is using setInterval()
Possible Duplicate: Android - check for presence of another app How to check if
Possible Duplicate: How to check iOS version? I'm building an app that has an
Possible Duplicate: How can you check for a #hash in a URL using JavaScript?
Possible Duplicate: How can you check for a #hash in a URL using JavaScript?
Possible Duplicate: How can I check if an ip is in a network in
Possible Duplicate: Can I scroll a ScrollView programmatically in Android? I have a chat

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.