Created
August 22, 2018 09:31
-
-
Save ssaurel/1ac6d126bb14883ccb452cf85706e268 to your computer and use it in GitHub Desktop.
Check Permissions for the GPS Tutorial on the SSaurel's Blog :
This file contains 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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
locationTv = findViewById(R.id.location); | |
// we add permissions we need to request location of the users | |
permissions.add(Manifest.permission.ACCESS_FINE_LOCATION); | |
permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION); | |
permissionsToRequest = permissionsToRequest(permissions); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
if (permissionsToRequest.size() > 0) { | |
requestPermissions(permissionsToRequest. | |
toArray(new String[permissionsToRequest.size()]), ALL_PERMISSIONS_RESULT); | |
} | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment