I have an activity that makes a call:
public void call(String number) {
Intent intent = new Intent("android.intent.action.CALL");
intent.setData(Uri.parse("tel:" + number));
intent.putExtra("MY_EXTRA", "Hello");
startActivity(intent);
finish();
}
I set up a broadcast receiver for calls:
public class OutgoingCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("Extra", intent.getStringExtra("MY_EXTRA", "Default"));
}
}
}
And registered it:
<receiver android:name=".OutgoingCallReceiver">
<intent-filter android:priority="-1">
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</receiver>
The broadcast receiver works. But regardless of whether it receives the event from the dialer or from my Activity, there is no extra.
Why are the extras not going through?