Add Java class in Manifest
Solved
Mobile and Embedded
-
wrote on 16 Apr 2018, 21:06 last edited by
Hi!
I want to add a Java class to my project. But the class does not work. In android studio project this code works.
My Manifest:<manifest package="org.qtproject.example.TestPlayer" ~...~> <application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="TestPlayer"> <activity android:name="org.qtproject.qt5.android.bindings.QtActivity" ~...~> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <!-- My new class --> <receiver android:name="org.qtproject.qt5.android.bindings.BootReceiver"> <intent-filter > <action android:name= "android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver> ~...~ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
My Java class:
package org.qtproject.qt5.android.bindings; ~...~ public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("TestPlayer", "onReceive"); Intent myIntent = new Intent(context, QtActivity.class); // it is right? myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(myIntent); } }
In general, I want to make a kiosk mode on android. Maybe you know more elegant way?
-
wrote on 23 Apr 2018, 22:39 last edited by