Gain BroadcastReceiver does not receive additional services

I have a very strange problem.

I am sending a broadcast and installing some additional features, but the receiver is not receiving 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 getting:

public void onReceive(Context context, Intent intent) {

        String downloadID =   intent.getExtras().getString(InitialActivity.DOWNLOAD_ID);

        Log.i(TAG, "downloadID :  "+ downloadID);
    }
};

      

The downloadID is null for some reason. Any hints?

thank

+3


source to share


1 answer


Try setting your intent like this



Intent i = new Intent(getApplicationContext(), MyReceiver.class);

      

0


source







All Articles