Skip to content

Conversation

@SachinAgarwal1337
Copy link

@SachinAgarwal1337 SachinAgarwal1337 commented Feb 23, 2022

The plugin works perfectly in all devices except for Andorid 12.
I get following error

 Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent

I see the problem is in createPendingIntent Method

 private void createPendingIntent() {
        if (pendingIntent == null) {
            Activity activity = getActivity();
            Intent intent = new Intent(activity, activity.getClass());
            intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            pendingIntent = PendingIntent.getActivity(activity, 0, intent, 0); // Problem in the last param here
        }
    }

This PR solves the problem by just adding the requried flag which also works for lower android versions

Solve the issue I raised #465

The plugin works perfectly in all devices except for Andorid 12. 
I get following error
```
 Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent
```

I see the problem is in  `createPendingIntent` Method
```
 private void createPendingIntent() {
        if (pendingIntent == null) {
            Activity activity = getActivity();
            Intent intent = new Intent(activity, activity.getClass());
            intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            pendingIntent = PendingIntent.getActivity(activity, 0, intent, 0); // Problem in the last param here
        }
    }
```

This PR solves the problem by just adding the requried flag which also works for lower android versions
@SachinAgarwal1337
Copy link
Author

@don hey, by any chance can you look at this PR please? It will be very very helpful.
Thank you in advance :)

@somq
Copy link

somq commented Apr 25, 2022

I confirm this bug happens on Android 12 and hardcrashes any app with thepluging.
The attached PR fixes it.

In the meantime:
package.json

[...]
"dependencies": {
    "phonegap-nfc": "SachinAgarwal1337/phonegap-nfc#patch-1",
[...]
}

(Ping @don)

@VasanthCBH
Copy link

I am also confirming on this bug, and it is blocker for using the plugin in Android 12 + (12 or 13 beta). (Ping @don )

@MrElectroNick
Copy link

Hi @don, @krimple, @gonzalo123, @doncoleman - any updates on this?

@VasanthCBH
Copy link

Hi @don @gonzalo123 @doncoleman - Any update on this?

@adnanebrahimi
Copy link

Any Update???

@moustario moustario mentioned this pull request Dec 15, 2022
paolosanchi added a commit to paolosanchi/phonegap-nfc that referenced this pull request Dec 30, 2022
@dwettstein
Copy link

Already included in #460, thus this PR could be closed as duplicate.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants