Skip to content

Conversation

@somq
Copy link

@somq somq commented May 24, 2022

avargaskun and others added 10 commits November 2, 2021 23:53
Currently attempting to write a tag will fail because the tag information is not persisted in `savedIntent` as part of the reader session. This only affects Android.
* To play nice with other plugins which may define the `continueUserActivity` method in AppDelegate
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
@dwettstein
Copy link

Note: This PR builds up on top of parts from PR #460.

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.

4 participants