Skip to content

Android 14 problem - initialization broadcast intent with MParticle.ServiceProviders.BROADCAST_ACTIVE should set package too #478

Description

@fada21

We had a problem that kit activated broadcast (MParticle.ServiceProviders.BROADCAST_ACTIVE_xx) were not received on devices on Android 14.

It turns out that our registered receiver used recommended flag Context.RECEIVER_NOT_EXPORTED and that requires package set on intent.

Here sdk code from v5.55.2

Intent intent = new Intent(MParticle.ServiceProviders.BROADCAST_ACTIVE + activeKit.getConfiguration().getKitId());
getContext().sendBroadcast(intent);

We suggest change like:

        Intent intent = new Intent(MParticle.ServiceProviders.BROADCAST_ACTIVE + activeKit.getConfiguration().getKitId());
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
            intent.setPackage(getContext().getPackageName())
        }
        getContext().sendBroadcast(intent); 

See external tracked issue here: https://issuetracker.google.com/issues/293487554#comment14
and stackoverflow: https://stackoverflow.com/a/76920719

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions