Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Runtime permssion with Android check doesn't enable location #8

Open
arkangelx opened this issue Jul 25, 2016 · 1 comment
Open

Runtime permssion with Android check doesn't enable location #8

arkangelx opened this issue Jul 25, 2016 · 1 comment

Comments

@arkangelx
Copy link

I have the following code
AndroidPermissions.check(this)
.permissions(android.Manifest.permission.ACCESS_FINE_LOCATION)
.hasPermissions(permissions -> {
})
.noPermissions(permissions1 -> {
ActivityCompat.requestPermissions(SplashActivity.this
, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}
, REQUEST_CODE_ASK_PERMISSIONS);
})
.check();

and
switch (requestCode) {
case REQUEST_CODE_ASK_PERMISSIONS:
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                AndroidPermissions.result()
                        .addPermissions(REQUEST_CODE_ASK_PERMISSIONS,  android.Manifest.permission.ACCESS_FINE_LOCATION)
                        .putActions(REQUEST_CODE_ASK_PERMISSIONS, () -> {

                        }, (hasPermissions, noPermissions) -> {
                            openMainAndFinish(SplashActivity.this, splashLibraryLazy.get());
                        })
                        .result(requestCode, permissions, grantResults);


            }

My issue is that it doesn't enable the location on the device and I get lat/lng showing 0.000000. Till i manually turn on location.
Please advise

@gordor4
Copy link

gordor4 commented Mar 13, 2018

after API 21 you can't request permission more that once

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants