I have a problem with my BroadcastReceiver. It's not working. I couldn't find any satisfying answers for my problem. This is my code fragments:
<receiver
android:name=".CameraReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.CAMERA_BUTTON" />
</intent-filter>
</receiver>
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "It's working!", Toast.LENGTH_LONG).show();
}
I tried, following some suggestions I've found in the internet, to add something like this:
<intent-filter android:priority="100000">
And so on, nevertheless there was no effect.
When I change android.intent.action.CAMERA_BUTTON to anything else, and do this action (for example android.net.wifi.WIFI_STATE_CHANGED), there always appears a Toast "It's working". But not when I use android.intent.action.CAMERA_BUTTON and take a photo. I don't know what's going on.
Any suggestions? I use Android emulator 2.2 and 2.3.3.