Run QT application on boot using Android boot complete intent
-
wrote on 8 Oct 2019, 18:31 last edited by
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?? } }
-
wrote on 6 Mar 2020, 07:25 last edited by
I am in need of something like that, who can help I?
Thanks for all! -
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?? } }
wrote on 6 Mar 2020, 08:43 last edited by@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); } }
-
wrote on 6 Mar 2020, 10:15 last edited by
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.
-
wrote on 7 Mar 2020, 00:19 last edited by
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.
-
@namduc As far as I know there is kiosk mode in Android since Lollipop. You should take a look at that.
wrote on 10 Mar 2020, 07:46 last edited by namduc 3 Oct 2020, 07:47@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/@namduc What I meant was that there should be already kiosk mode in Android in recent versions, so no need to implement it. My guess is that you need to activate it on the device.