android - BroadcastReceiver doesn't work -


i added receiver in manifest

<receiver android:name=".packagereceiver"         android:enabled="true">         <intent-filter android:priority="100">             <action android:name="android.intent.action.package_added"/>             <action android:name="android.intent.action.package_replaced"/>             <data android:scheme="package"/>         </intent-filter>   </receiver> 

and broadcastreceiver

public class packagereceiver extends broadcastreceiver{ @override public void onreceive(context context, intent intent) {      log.e("noti", "sucess");     //start notification service     intent = new intent(context, notificationservice.class);     context.startservice(i); }} 

..

when install package, it's didn't work...

this package don't have activity.(only service , resource)

is problem?

then..

how call broadcastreceiver in package without activity?

this question asked lot.

check out commonsware blog.

starting 3.1 when applications installed in “stopped” state not able run until user explicitly launches them. pressing force stop return them state.

there needs active component in application user can start. when activity gets started, broadcastreceiver registered.


Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -