Zellius / RxLocationManager

RxJava wrap around standard Android LocationManager without Google Play Services
MIT License
118 stars 8 forks source link

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

Open arkangelx opened 8 years ago

arkangelx commented 8 years ago

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 commented 6 years ago

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