Run QT application on boot using Android boot complete intent
-
Hello,
I'm trying to launch my QT application on an Android device on boot. Unfortunately, I don't know what to call in the 'onReceive' method. Any Ideas?In the manifest, I've allowed the boot complete permission and I've attached the receiver to the intent:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> ... ... ... <receiver android:name="org.qtproject.example.boot.BootReceiver" android:enabled="true"> <intent-filter android:priority="100"> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver>
Here is the boot receiver:
public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { what goes here?? } }
-
Hello,
I'm trying to launch my QT application on an Android device on boot. Unfortunately, I don't know what to call in the 'onReceive' method. Any Ideas?In the manifest, I've allowed the boot complete permission and I've attached the receiver to the intent:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> ... ... ... <receiver android:name="org.qtproject.example.boot.BootReceiver" android:enabled="true"> <intent-filter android:priority="100"> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver>
Here is the boot receiver:
public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { what goes here?? } }
@mkre I guess you should do this:
public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // StartActivity is the class name of your activity // => cf android:name attribute from activity tag in AndroidManifest.xml Intent i = new Intent(context, StartActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } }
-
Great, it worked for me
On the sidelines, I need my application to run continuously on android devices so is there a way to block the Home button and Menu button so that the app does not exit when the user presses them.
Any ideas or links to help me would be so grateful!
Thank you very much! -
Great, it worked for me
On the sidelines, I need my application to run continuously on android devices so is there a way to block the Home button and Menu button so that the app does not exit when the user presses them.
Any ideas or links to help me would be so grateful!
Thank you very much!@namduc said in Run QT application on boot using Android boot complete intent:
is there a way to block the Home button and Menu button so that the app does not exit when the user presses them.
I don't think so and who would like to use such an app? Use a background service if you want to do something if the main app is not running.
-
Can't a regular Qt Qml app be shown in android on top of other apps?
usingWindowManager.LayoutParams.TYPE_SYSTEM_ALERT
in QtActivity, somewhere. -
@namduc said in Run QT application on boot using Android boot complete intent:
is there a way to block the Home button and Menu button so that the app does not exit when the user presses them.
I don't think so and who would like to use such an app? Use a background service if you want to do something if the main app is not running.
-
@jsulm i'm building a app for Working Kiosk Mode in Android,Of course I will have the function to exit my application when needed.
can you help me?
Thanks! -
@namduc As far as I know there is kiosk mode in Android since Lollipop. You should take a look at that.
@jsulm yes, i I followed this tutorial but when pressing the Home button the app still exits, this tutorial is written in java, I don't know where the error was, are there any instructions related to Qt?
https://www.andreasschrade.com/2015/02/16/android-tutorial-how-to-create-a-kiosk-mode-in-android/ -
@jsulm yes, i I followed this tutorial but when pressing the Home button the app still exits, this tutorial is written in java, I don't know where the error was, are there any instructions related to Qt?
https://www.andreasschrade.com/2015/02/16/android-tutorial-how-to-create-a-kiosk-mode-in-android/