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
Post a Comment