A
A
Anton Misyagin2020-04-25 00:05:19
Android
Anton Misyagin, 2020-04-25 00:05:19

Where should I put my AdminManager.java in a QT project?

Hi all. Trying to make a kiosk mode app for android 5.1 using QT 5.9.9
AndroidManifest.xml

<?xml version="1.0"?>
<manifest package="inc.garage.ncf05m" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.1" android:versionCode="1" android:installLocation="auto">
    <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon">
        <receiver android:name=".AdminManager" android:permission="android.permission.BIND_DEVICE_ADMIN">
            <meta-data android:name="android.app.device_admin" android:resource="@xml/policies" />
            <intent-filter>
                <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
            </intent-filter>
        </receiver>

        <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="portrait" android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
                <category android:name="android.intent.category.HOME"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.settings.SETTINGS"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
.....


/android/res/xml/policies.xml
<device-admin>
</device-admin>


/android/src/inc/garage/nfc05m/AdminManager.java
package inc.garage.nfc05m;
import android.app.admin.DeviceAdminReceiver;
public class AdminManager extends DeviceAdminReceiver{
}


After deploying the application, I try to get the device owner adb:
$adb shell dpm set-device-owner inc.garage.ncf05m/.AdminManager
Success: Device owner set to package inc.garage.ncf05m
Active admin set to component {inc.garage.ncf05m/inc.garage.ncf05m.AdminManager}


At the same time, the application crashes and application output qt creatora says the following:

LOGCAT: E/AndroidRuntime( 2110): FATAL EXCEPTION: main

LOGCAT: E/AndroidRuntime( 2110): Process: inc.garage.ncf05m, PID: 2110

LOGCAT: E/AndroidRuntime( 2110): java.lang.RuntimeException: Unable to instantiate receiver inc.garage.ncf05m.AdminManager: java.lang.ClassNotFoundException: Didn't find class "inc.garage.ncf05m.AdminManager" on path: DexPathList


The question is where to put the file with the AdminManager class so that everyone can find it if necessary. Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question