react-native-navigator的權限Bug修改

public class ReactDevPermission {
    private static final String REDBOX_PERMISSION_MESSAGE =
            "Overlay permissions needs to be granted in order for react native apps to run in dev mode";

    public static boolean shouldAskPermission() {
        return NavigationApplication.instance.isDebug() &&
                Build.VERSION.SDK_INT >= 23 &&
                !Settings.canDrawOverlays(NavigationApplication.instance);
    }

    @TargetApi(23)
    public static void askPermission(Context context) {
        Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName()));
        FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE);
        Toast.makeText(context, REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show();
        context.startActivity(serviceIntent);
    }
}
相關文章
相關標籤/搜索