Why would an OrderedBroadcast work in the debug build of the app but not in release? I am sending the following OrderedBroadcast:
context.sendOrderedBroadcast(sendInt, "xxx.xxxx.permission.API", new BroadcastReceiver() {
@SuppressLint("NewApi")
@Override
public void onReceive(Context receivercontext, Intent intent) {
Bundle results = getResultExtras(true);
if (results.getInt("Result", Activity.RESULT_CANCELED) == Activity.RESULT_OK) {
Log.d("DEBUG", "OK");
} else {
Log.e("DEBUG", "Failed");
}
}
}, null, Activity.RESULT_OK, null, null);
Both apps have the appropriate permission in the AndroidManifest.xml file and the receiver is declared as follows:
<receiver android:name="xxx.xxxx.xxxx.Receiver1"
android:enabled="true"
android:exported="true"
android:permission="xxx.xxxx.permission.API">
<intent-filter>
<action android:name="xxx.xxxx.permission.API.1" />
</intent-filter>
</receiver>
As I mentioned if I have both the sender and receiver apps running in debug builds then everything works perfectly however if I run the receiver app in release mode (no proguard or anything) the the sender app just gets the RESULT_CANCELLED
result?
This has bugged me for days so any ideas would be greatly appreciated.