在拒绝位置许可后,我的应用程序运行缓慢

时间:2015-12-16 12:16:42

标签: android

在我的应用程序中,我必须要求用户允许ACCESS_FINE_LOCATION权限。如果用户点击允许对话框,那么进一步与应用程序的交互是顺利的但是用户否认它然后应用程序运行得如此之慢。任何建议?

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);

    if (requestCode == REQUEST_FINE_LOCATION) {
        for (int i = 0; i < permissions.length; i++) {
            String permission = permissions[i];
            Log.d("PERMISSION",permission);
            int grantResult = grantResults[i];

            if (permission.equals(Manifest.permission.ACCESS_FINE_LOCATION)) {
                if (grantResult == PackageManager.PERMISSION_GRANTED) {
                    Log.d("Action","Permission");
                    isLocationAccessible=true;
                } else {
                    Log.d("Action", "Reject");
                    isLocationAccessible=false;
                }
            }}}}    /*When log says Permission then further interection with app is smooth but when log says Reject then application runs so slow*/ @EdGeorge

0 个答案:

没有答案