is there any API available to receive the broadcast receiver for app started.

by manoj » Mon, 09 Aug 2010 14:10:10 GMT


Sponsored Links
 Hi All,

I have one question.

I want to receive a broadcast receiver whenever any app is started.

for example:
I have an app which has the broadcast receiver which listens for the
app started event .

I installed this app on the device.

Now I have opened the Phone or Contacts app. Now my app which is
listening for this kind of event(app opened or started) has to be
invoked.

can any one tell me the solution?

Thanks,
Manoj.

--



is there any API available to receive the broadcast receiver for app started.

by Frank Weiss » Mon, 09 Aug 2010 14:51:57 GMT


 Correct me if I'm wrong, but "app" is a bogus term with regard to an
Android broadcast receiver. Don't you mean to ask what intent and
category do the Phone and Contacts apps use, such as:

android.intent.action.MAIN, android.intent.category.LAUNCHER

--


Sponsored Links


is there any API available to receive the broadcast receiver for app started.

by Gibson » Mon, 09 Aug 2010 15:13:47 GMT


 Seems like no.....




--



is there any API available to receive the broadcast receiver for app started.

by Dianne Hackborn » Mon, 09 Aug 2010 15:47:54 GMT


 There is no app started broadcast to listen for.




>



is there any API available to receive the broadcast receiver for app started.

by Indicator Veritatis » Tue, 10 Aug 2010 05:05:40 GMT


 The real solution is: study 
 http://developer.android.com/guide/topics/fundamentals.html ,
especially the parts on lifecycles of activities, services and
broadcast receivers ( http://developer.android.com/guide/topics/ 
fundamentals.html#lcycles). Then take into account what Dianne said
(that there is no such broadcast). After studying that section, you
will more likely come up with the real solution to your problem. It
may help, for example, to notice that though there is no "app started"
broadcast, you can tell when your own applications/activities lose the
foreground or become invisible. This is almost the same information,
since launching another app is what causes yours to lose foreground
(device going to sleep will do this too). So you may be able to get
close enough by waiting for onPause() and onStop() events, overriding
these methods.




--



Other Threads

1. Question Using a Service with an Appwidget

As recommended I am using a service to update my AppWidget.  The service
is started in onUpdate and also in onReceive upon receipt of specific
intents.  My question is simple: am I supposed to do anything to manage
the lifecycle of that service?  Should I ever stop it or do anything
else explicit with it as I would, for example, with an alarm where it
has to be canceled when you are done?  Or will Android take care of if
for me?

-- 
Jake Colman -- Android Tinkerer

-- 

2. Database handling - when do you open and close

@YuviDroid

I'm trying the following at the moment: the open() only gets called in
both onCreate() methods with:

        mDb = new DbAdapter(this);
        if(mDb.getDatabase() == null || !mDb.getDatabase().isOpen()) {
          mDb.open();
        }

The problem I'm having with this is, that there is always a new
DbAdapter created which is fine when the activity is created the first
time. But this way "mDb.getDatabase() == null" will be always true
because its a new mDb.

So I either need to find a way to check if the database is opened
without "mDb" or need to remember mDb even if the activity is stopped.

@Kostya Vasilyev

I tried that, but then my app crashes while switching between
activities. When I was searching for the error I put logs in the
open() and close() methods by my DbAdapter and I could see the
following:

 * open()  (app, activity1 started)
 * open()  (i hit a button in activity1, activity2 is starting and
open is called within onStart)
 * close()  (activity1 is stopped, in onStop close is called)

When I go back to activity1 it throws an exception because the
database is closed. -.-

-- 

3. OOT: live report from JCC

4. Videoview and surfaceView problems

5. WT Share : Step by step SimpleRoot OTA 1.47.651.1 Untuk HTC EVO 4G

6. Canceling an Alarm in an AppWidget

7. Droid X protected with eFuse? Really?