安装APK时权限未显示 [英] Permissions not showing while installing apk

查看:114
本文介绍了安装APK时权限未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FlashBuilder使用ActionScript制作一个Android应用.我需要为我的应用使用WiFi权限.该应用程序可以在桌面上正常运行(AIR桌面项目).现在,当我尝试将其用于Android(Mobile Project)时,它没有显示任何错误.我启用了我需要的权限(网络和wifi),并制作了.apk文件.但是,当我在Android 6.0.1设备上安装.apk文件时(注5),它声称该应用程序不要求任何权限. 我决定从Adobe网站

I'm making an Android app with ActionScript using FlashBuilder. I need to use The WiFi permission for my app. The application works on desktop with no problems(AIR Desktop project). Now when I tried to make it for Android(Mobile Project), it showed me no errors. I enabled the permissions I needed (Network and wifi) and made the .apk file. However, when I install the .apk file on my Android 6.0.1 device(Note 5) it claims that the app asks for no permissions. I decided to ask for all the permissions from the adobe website

<android> 
<manifestAdditions> 
    <![CDATA[ 
        <manifest> 
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 
            <uses-permission android:name="android.permission.CAMERA" /> 
            <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> 
            <uses-permission android:name="android.permission.INTERNET" /> 
            <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
            <uses-permission android:name="android.permission.RECORD_AUDIO" /> 
            <uses-permission android:name="android.permission.WAKE_LOCK" /> 
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
        </manifest> 
    ]]> 
</manifestAdditions> 

它要求一些但不要求一些.不需要的是以下

It asks for some but not for some. The ones it doesn't ask for are the following

<manifest> 
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 
            <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> 
            <uses-permission android:name="android.permission.INTERNET" /> 
            <uses-permission android:name="android.permission.WAKE_LOCK" /> 
        </manifest> 

我尝试使用FlashBuilder创建一个新的MobileProject.我将其保留为默认设置(黑屏),并要求获得互联网许可.它还不要求许可.这两个应用程序在午餐后立即崩溃.

I tried making a new MobileProject with FlashBuilder. I left it as default(blank screen) and asked for the internet permission. It also doesn't ask for the permission. Both apps crash upon lunch immediately.

现在,在包含权限的文件上出现警告,未检测到文档的语法约束(DTD或XML模式)",但实际上它出现在新项目上,甚至没有涉及任何内容.

Now there's a warning on the file containing the permissions, "No grammar constraints (DTD or XML schema) detected for the document" but that actually appears on a new project before I even touch anything in it.

推荐答案

Actually android has new policy to show runTime premission from the marshmallow to you need to implement premission at runtime like this in Activity


  protected void checkPermissionForReadWriteStorage() {

        final int writeExternalStorage = ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
        final int readExternalStorage = ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE);
        if (writeExternalStorage == PackageManager.PERMISSION_GRANTED && readExternalStorage == PackageManager.PERMISSION_GRANTED) {


        } else {
            boolean requestPermissionRationale = ActivityCompat.shouldShowRequestPermissionRationale(BaseActivity.this, android.Manifest.permission.READ_EXTERNAL_STORAGE);
            if (requestPermissionRationale) {

                Toast.makeText(BaseActivity.this, "Please provide  permission for reading images from gallery.", Toast.LENGTH_SHORT).show();
                Intent intent = new Intent();
                intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                Uri uri = Uri.fromParts("package", BaseActivity.this.getPackageName(), null);
                intent.setData(uri);
                BaseActivity.this.startActivity(intent);
            } else {
                ActivityCompat.requestPermissions(BaseActivity.this, new String[]{android.Manifest.permission.READ_EXTERNAL_STORAGE,
                        android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
            }
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        switch (requestCode) {
            case 2:
                if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//                    getLocationAndSaveInDatabaseOrEnableGPS();


                }
                break;
        }
    }

这篇关于安装APK时权限未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆