In the manifest I've declared the receiver element correctly to the best of my knowledge. But the Receiver never gets called when I send out the broadcast. The log cat shows.
07-22 23:51:49.181: E/AndroidRuntime(3799): FATAL EXCEPTION: main
07-22 23:51:49.181: E/AndroidRuntime(3799): java.lang.RuntimeException: Unable to instantiate receiver com.example.orderedbroadcastreceiver.HigherPriorityReceiver: java.lang.IllegalAccessException: access to class not allowed
07-22 23:51:49.181: E/AndroidRuntime(3799): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2333)
07-22 23:51:49.181: E/AndroidRuntime(3799): at android.app.ActivityThread.access$1500(ActivityThread.java:139)
07-22 23:51:49.181: E/AndroidRuntime(3799): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
07-22 23:51:49.181: E/AndroidRuntime(3799): at android.os.Handler.dispatchMessage(Handler.java:99)
07-22 23:51:49.181: E/AndroidRuntime(3799): at android.os.Looper.loop(Looper.java:137)
07-22 23:51:49.181: E/AndroidRuntime(3799): at android.app.ActivityThread.main(ActivityThread.java:4899)
07-22 23:51:49.181: E/AndroidRuntime(3799): at java.lang.reflect.Method.invokeNative(Native Method)
07-22 23:51:49.181: E/AndroidRuntime(3799): at java.lang.reflect.Method.invoke(Method.java:511)
07-22 23:51:49.181: E/AndroidRuntime(3799): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
07-22 23:51:49.181: E/AndroidRuntime(3799): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
07-22 23:51:49.181: E/AndroidRuntime(3799): at dalvik.system.NativeStart.main(Native Method)
07-22 23:51:49.181: E/AndroidRuntime(3799): Caused by: java.lang.IllegalAccessException: access to class not allowed
07-22 23:51:49.181: E/AndroidRuntime(3799): at java.lang.Class.newInstanceImpl(Native Method)
07-22 23:51:49.181: E/AndroidRuntime(3799): at java.lang.Class.newInstance(Class.java:1319)
07-22 23:51:49.181: E/AndroidRuntime(3799): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2328)
07-22 23:51:49.181: E/AndroidRuntime(3799): ... 10 more
Code
class HigherPriorityReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "HigherPriorityReceiver", 0).show();
setResultCode(1985);
setResultData("DOB");
//abortBroadcast();
}
make class HigherPriorityReceiver
a public
class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With