I have very strange problem.
I am sending broadcast and setting some extras but receiver is not getting them :
Sending :
private void notifyAboutDownload(String reference, Context ctx) {
Intent i = new Intent(InitialActivity.ACTION_PACKAGE);
i.setAction(InitialActivity.ACTION_DOWNLOAD_COMPLEATED);
i.putExtra(InitialActivity.DOWNLOAD_ID, reference);
ctx.sendBroadcast(i);
}
And receiving :
public void onReceive(Context context, Intent intent) {
String downloadID = intent.getExtras().getString(InitialActivity.DOWNLOAD_ID);
Log.i(TAG, "downloadID : "+ downloadID);
}
};
For some reason downloadID is null. Any hints?
thanks
尝试像这样设置你的意图
Intent i = new Intent(getApplicationContext(), MyReceiver.class);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.