6

In AndroidManifest.xml:

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="23" />
<uses-permission-sdk-m android:name="android.permission.ACCESS_FINE_LOCATION"/>

And in PreActivity.java

if (PermissionChecker.checkSelfPermission(preActivity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
    if (ActivityCompat.shouldShowRequestPermissionRationale(preActivity, Manifest.permission.ACCESS_FINE_LOCATION)){
        setDisplay();

    } else {
        // show dialog here
        ActivityCompat.requestPermissions(preActivity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSION_CODE);

    }
} else {
    ~~~~~
}

After requestPermissions() is called, onRequestPermissionsResult is called without showing confirmation dialog box.

Does anyone know what the problem is, or how to show this dialog?

Thank you.

dti-noue
  • 97
  • 8

1 Answers1

0

This is probably happening because you have already granted the required permission to your app.

To test from scratch first uninstall your app and then try again. This way all of the previously granted permissions will be revoked.

SMR
  • 6,628
  • 2
  • 35
  • 56
  • Thank you for answering, SMR. But sorry, the problem doesn't solve. I call this at the starting of my app, and if I call a method using GPS at the next, SecurityException occurs and my app terminates forcibly. – dti-noue Apr 12 '16 at 09:43