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 8689039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:32:06+00:00 2026-06-12T23:32:06+00:00

Is there a way to know who is the application caller? These are several

  • 0

Is there a way to know who is the application caller?

These are several use cases cases:

  • I have an application and a widget of it. Application is not running. Once I add/remove the widget, the system calls the application to run (Application.onCreate() is called and etc..). So I need to know that this is not a user who press an icon to run application, but this is a system needs to update widget.
  • When I get low of memory, the system kills the application and then restors it again when there is enough memory. The question is the same as above.
  • More similar cases…

The only case that I can manage is a BootUpReceiver which is extended from BroadcastReceiver. Only in this case I am sure that the application is run by the “launch at start” feature.

I need to know for sure – who (what service, receiver, intent, etc) any why is calling my application.

Is there a way to know the caller source, or caller ID or any information about a service or any other who call my application to run?

  • 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-12T23:32:08+00:00Added an answer on June 12, 2026 at 11:32 pm

    As @CommonsWare already mentioned:

    the better answer is to redesign your application such that you do not care why your code is being run.

    But actually you can get a general idea about why your application was called by dumping message query of MainLooper. You can use following code to do this:

    public static void dumpMainLooper(Context context) {
        Looper looper = context.getMainLooper();
        try {
            looper.dump(new Printer() {
                @Override
                public void println(String s) {
                    Log.d(LOG_TAG, "- " + s);
                }
            }, "AppMainLooperDump");
        } catch (Throwable th) {
            Log.d(LOG_TAG, "App Main Looper error", th);
        }
    }
    

    You shouldn’t use this code for any “logic” in your app, but you can use it for debugging and/or logging to get a general idea about Intents sent by system to your app to start it. You should call this method as early as possible, and in logs you will see something like this:

    Looper{41ff0388}
    mRun=true
    mThread=Thread[main,5,main]
    mQueue=android.os.MessageQueue@41ff03a8
      Message 0: { what=100 when=-438ms obj=ActivityRecord{41ff43e0 token=android.os.BinderProxy@41ff3b78 {com.your.package/com.your.package.MainActivity}} }
      Message 1: { what=132 when=+9s911ms }
    (Total messages: 2)
    

    Message N – this is a messages which was send by the system to your app. Here you will see defferent messages and this messages should give you a general idea about callers of your app.

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

Sidebar

Related Questions

Is there a way I can know who holds a reference to an object?
Is there any way to know in Servlet is JS is enable or not
Is there any way to know which version of MS-Office I have on my
Is there a way to know when code is being called from running a
Is there a way to know where is set a given PHP config property?
Is there a way to know if Visual C++ 2008 SP1 Redistributable Package is
is there a way to know when an object will be disposed by GC?
Is there any way to know for events when move a window with window.open?.
Is there a way to know when a view is viewable to user? For
Is there a way to know that the user is closing the navigator, and/or

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.