Qt World Summit: Register Today!

Add Java class in Manifest

  • 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">
                      android:name="org.qtproject.qt5.android.bindings.QtActivity" ~...~>
                          <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" />
    		<!-- My new class -->
                      <receiver android:name="org.qtproject.qt5.android.bindings.BootReceiver">
                        <intent-filter >
                            <action android:name=
        <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    My Java class:

    package org.qtproject.qt5.android.bindings;
    public class BootReceiver extends BroadcastReceiver {
        public void onReceive(Context context, Intent intent) {
            Log.d("TestPlayer", "onReceive");
            Intent myIntent = new Intent(context, QtActivity.class); // it is right?

    Java class in my project:

    In general, I want to make a kiosk mode on android. Maybe you know more elegant way?

  • I create template in Projects->Build Android APK. Here's what I got:

    I added the class BootReceiver to the folder src\org\qtproject\qt5\android\bindings. And it worked for me!

Log in to reply