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

Android 12 'nearby devices' permission support #214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thide11
Copy link

@thide11 thide11 commented Feb 16, 2024

In recent years, a global trend is to increase user privacy

And with the advancement of Android, it was no different here

In versions lower than Android 12, to use Bluetooth, you needed to request the user's location, a bold permission and for users it doesn't make sense to ask for location to use Bluetooth

Thanks to android 12 a new permission can be asked from users: "nearby devices", this pull request uses the new android manifest permissions so you don't need to request location from users on more modern devices

Before: After:
before after

Several pull requests have already been made in this project with the same functionality, but I decided to create my own for the following reasons:

  • They ask on old devices for location permission to turn Bluetooth on and off, there is no need to ask if you don't go beyond that, in more modern versions, then yes, 'nearby devices' permission is needed to turn Bluetooth on/off
  • The error message if it does not have permission is generic or unchanged, in this pull request it warns that the 'nearby devices' permission is missing if it is a new device and 'localization' if it is an older device
  • Some created very long ifs or duplicated calls to methods that you don't need, such as ActivityCompat.requestPermissions

Hope this contribution helps!

@Christyansoft
Copy link

any news about this pr ?

Copy link

@toshiossada toshiossada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGFM

Syutkin added a commit to Syutkin/flutter_bluetooth_serial that referenced this pull request Sep 5, 2024
@edufolly
Copy link
Owner

This will be fixed in version 0.5.0.

I'll keep this PR open for reference.

@edufolly edufolly added the good first issue Good for newcomers label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants