Skip to content

Android12 raises a Exception with onPushReceive #1137

Closed
@junya100

Description

@junya100

New Issue Checklist

Issue Description

 The following exception is raised with Android12 when onPushReceive is called.
 And targetSDKVersion is 31.

 Caused by: java.lang.IllegalArgumentException: my.package: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
    at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
    at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
    at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
    at com.parse.ParsePushBroadcastReceiver.getNotification(ParsePushBroadcastReceiver.java:430)
    at com.parse.ParsePushBroadcastReceiver.onPushReceive(ParsePushBroadcastReceiver.java:168)

Steps to reproduce

Call ParsePushBroadcastReceiver#onPushReceive method.

Actual Outcome

Caused by: java.lang.IllegalArgumentException: my.package: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
at com.parse.ParsePushBroadcastReceiver.getNotification(ParsePushBroadcastReceiver.java:430)
at com.parse.ParsePushBroadcastReceiver.onPushReceive(ParsePushBroadcastReceiver.java:168)

Expected Outcome

No exception.

Environment

any Parse Android SDK version with Android12 and targetSDKVersion 31

Parse Android SDK

  • SDK version: 2.0.3
  • Operating system version: Android12

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions