Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sample code in README #1118

Closed
wants to merge 1 commit into from
Closed

Conversation

mbernson
Copy link

Description

In modern Android, the flag PendingIntent.FLAG_MUTABLE is required. Otherwise the intent will not return any data when authentication is completed or canceled.

I've updated the code sample in the README to reflect this.

Motivation and Context

I'm a beginning Android developer and I was stuck on this for a while until I realised my error.

Checklist

  • I read the Contribution Guidelines
  • I signed the CLA and WG Agreements
  • I ran, updated and added unit tests as necessary.
  • I verified the contribution matches existing coding style.
  • I updated the documentation if necessary.

In modern Android, the flag `PendingIntent.FLAG_MUTABLE` is required. Otherwise the intent will not return any data when authentication is completed or canceled.
@PhilippNowak96
Copy link

Since this flag was added in API 31, you should add some check, e.g.

val intentFlags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
    PendingIntent.FLAG_MUTABLE
} else {
    0
}

See also Android Docs

@mbernson
Copy link
Author

Fair enough! Adding all that info to the README would not be relevant to AppAuth and the user of the library should "RTFM". :)

@mbernson mbernson closed this Feb 25, 2025
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.

2 participants