How to create BroadcastReceiver without activity / service?

I am trying to create a BroadcastReceiver without activity / service. Although I have no problems registering and executing the code, when the action is present in the code, when I delete its action.

I am registering a BroadcastReceiver with a manifest (!), But it is not called when the action is removed from the project.

<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <receiver android:name="com.ge.test.InstallsListener" > <intent-filter> <data android:scheme="package" /> <action android:name="android.intent.action.PACKAGE_ADDED" android:priority="100"/> </intent-filter> </receiver> </application> 

Thanks.

+4
android android-activity android-broadcast
source share
1 answer

But it is not called when the action is removed from the project.

In Android 3.1 and above, the user must run one of your actions before any registered BroadcastReceiver manifest will work.

See the release notes for Android 3.1 , in particular the “Launching controls in stopped applications” section.

+10
source share

All Articles