Android requestPermissions не показывает всплывающее окно разрешения на Android 9 без ActivityCompat - PullRequest
0 голосов
/ 20 апреля 2020

Выполнение некоторых НИОКР. Попытка создать действительно маленькое приложение (в пределах нескольких КБ), чтобы что-то сделать. Я использую Activity, а не ActivityCompat. Кажется, я не могу получить всплывающее окно разрешения. Даже в диспетчере приложений приложение не показывает никакого разрешения. RequestPermissions мгновенно вызывает onRequestPermissionResult с помощью DENIED. Вот мой код ..

Это действительно крошечное приложение с одним Activity, одним Service и одним BroacastReceiver. У меня также есть разрешение в манифесте. Копаю голову, но не понимаю, почему это происходит.

enter image description here

Вот мой Манифест

<?xml version="1.0" encoding="utf-8"?>

<application android:label="@string/app_name">

    <activity android:name="com.technofection.capture.MainActivity" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


    <receiver
        android:name="com.technofection.capture.MyReceiver"
        android:enabled="true"
        android:exported="false" android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
        <intent-filter>
            <action android:name="android.intent.action.TIME_TICK"></action>
            <action android:name="android.intent.action.BOOT_COMPLETED"></action>
        </intent-filter>
    </receiver>

    <service
        android:name="com.technofection.capture.MyService"
        android:enabled="true"
        android:exported="false" />

</application>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.intent.action.READ_CONTACTS"></uses-permission>

После исправления манифеста .. Я не могу запустить приложение на устройстве напрямую из android studio .. Вот ошибка, которую я вижу в консоли ..

 04/20 10:20:44: Launching 'Capturing App' on Xiaomi Redmi Note 5 Pro.
$ adb shell am start -n "com.technofection.capture/com.technofection.capture.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.technofection.capture/com.technofection.capture.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.technofection.capture/.MainActivity }
Error type 3
Error: Activity class {com.technofection.capture/com.technofection.capture.MainActivity} does not exist.

Error while Launching activity

Don't know why is this now.. But I can transfer the APK to phone and install it from there.. 
...