Important: Please read the Qt Code of Conduct -

Can't listen to android OS intents. ex.RECEIVE_BOOT_COMPLETED

  • I have an android service that runs when i open my app, now I want my android service to run at boot time.

    I added these permissions to the manifest:

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.RECEIVE_HEADSET_PLUG"/>

    Here's my receiver in the manifest:

    <receiver android:name="org.qtproject.example.MyBroadcastReceiver">
      <action android:name="android.intent.action.RECEIVE_BOOT_COMPLETED"/>
      <action android:name="android.intent.action.RECEIVE_HEADSET_PLUG"/>

    And here's

    import android.os.Bundle;
    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    public class MyBroadcastReceiver extends BroadcastReceiver {
        public void onReceive(Context context, Intent intent) {
            Intent startServiceIntent = new Intent(context, org.qtproject.example.MyCustomAppService.class);

  • Lifetime Qt Champion

    @Mena And what is the problem?
    "Can't listen to android OS intents. ex.RECEIVE_BOOT_COMPLETED" - does not tell much. What exactly is happening?

  • @jsulm The service does not start. No errors or anything. I can't see it running on my android phone neither after booting or after plugging a headset.
    However, if I start it from my application, it starts and i can see it running in the services on my phone.

  • ok , I was able to solve the problem!
    Here's the solution:

Log in to reply