FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Retrofit Geofencing by adaext · Pull Request #302 · android/location-samples · GitHub

This repository was archived by the owner on Aug 23, 2023. It is now read-only.
/ location-samples Public archive

Retrofit Geofencing - #302

Open
adaext wants to merge 3 commits into
android:mainfrom
adaext:upgrade_gradle
Open

Retrofit Geofencing#302
adaext wants to merge 3 commits into
android:mainfrom
adaext:upgrade_gradle

Conversation

adaext commented Sep 20, 2022

Copy link
Copy Markdown

Upgrade the Gradle and SDK to the latest version and add tristate support for location permission.

jdkoren left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@adaext In MainActivity.java the indent size changed from 4 spaces to 2 spaces, which doesn't match the format of the other files. The resulting diff is very large and doesn't reflect the changes specific to this PR. Can you please reset the indent to 4 spaces and reformat the file?

adaext commented Sep 21, 2022

Copy link
Copy Markdown
Author

@adaext In MainActivity.java the indent size changed from 4 spaces to 2 spaces, which doesn't match the format of the other files. The resulting diff is very large and doesn't reflect the changes specific to this PR. Can you please reset the indent to 4 spaces and reformat the file?

Ok, thanks.

marcelpinto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I have some concerns on the permissions best practices that would be great to solve.

[Optional] since you are formatting the code, could you update the sample code style?

  • Do not use Hungarian notation
  • Use ViewBinding instead

// Request permission. It's possible this can be auto answered if device policy
// sets the permission in a given state or the user denied the permission
// previously and checked "Never ask again".
ActivityCompat.requestPermissions(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Consider using registerForActivityResult with Permission Contract

https://developer.android.com/training/permissions/requesting#allow-system-manage-request-code

// previously and checked "Never ask again".
ActivityCompat.requestPermissions(
MainActivity.this,
new String[] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is not allowed since Android 11.

You should first request COARSE + FINE and then BACKGROUND separately

https://developer.android.com/about/versions/11/privacy/location#request-background-location-separately

// Return a GeofencingRequest.
return builder.build();
}
@Override

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This goes against the best practices. I understand for the sample might be okay, but I would consider moving this logic under a button/CTA in the screen.

R.string.permission_denied_explanation,
R.string.settings,
view -> {
// Build intent that displays the App settings screen.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

AFAIK showing the app details in system settings isn't a pattern we recommend for developers.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL