# Android broadcast receiver, autostart app on boot

**URL:** <https://forums.unrealengine.com/t/android-broadcast-receiver-autostart-app-on-boot/433572>\
**Category:** Mobile\
**Tags:** manifest, unreal-engine, Android, java, question\
**Created:** [September 11, 2018, 11:38am UTC](https://forums.unrealengine.com/t/android-broadcast-receiver-autostart-app-on-boot/433572 "2018-09-11T11:38:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanielDurys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanielDurys](https://forums.unrealengine.com/u/DanielDurys)\
**Post date:** [September 11, 2018, 11:38am UTC](https://forums.unrealengine.com/t/android-broadcast-receiver-autostart-app-on-boot/433572/1 "2018-09-11T11:38:24Z")

</div>

How to make the application waiting for android boot broadcast receiver and autostart itself?  
I turn on device and I want the application to autostart. I heard of broadcast receiver class in java, but how to add this to ue4 activity or manifest?  
I’m trying to add permission

 ![253406-permission.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/9/c/79c3c0ec18f2c897aea31587bbd5b2958f49a24a.png)

to the manifest and receiver

 ![253408-receiver.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/9/3/a938a2bb608c0a44b01ee83e8387cae6fa38462d.png)

to the application section

---

<div class="post-metadata">

**Author:** ![DanielDurys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanielDurys](https://forums.unrealengine.com/u/DanielDurys)\
**Post date:** [September 12, 2018, 10:00am UTC](https://forums.unrealengine.com/t/android-broadcast-receiver-autostart-app-on-boot/433572/2 "2018-09-12T10:00:22Z")

</div>

I’m trying to make this on Daydream Lenovo Mirage Solo (but this has Android so it should work)  
If I try run command in adb like this to test an application run:  
adb shell am broadcast -a android.intent.action.BOOT\_COMPLETED  
I got security exception and I’m not allowed to use this.

Security exception: Permission Denial: not allowed to send broadcast android.intent.action.BOOT\_COMPLETED from pid=3501, uid=2000

java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT\_COMPLETED from pid=3501, uid=2000  
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:19185)  
at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:19823)  
at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:614)  
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:154)  
at android.os.ShellCommand.exec(ShellCommand.java:96)  
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:15009)  
at android.os.Binder.shellCommand(Binder.java:573)  
at android.os.Binder.onTransact(Binder.java:473)  
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4256)  
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2940)  
at android.os.Binder.execTransact(Binder.java:674)

How can I disable that security on Mirage Solo?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_aeec2cc71](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_aeec2cc71](https://forums.unrealengine.com/u/anonymous_user_aeec2cc71)\
**Post date:** [August 10, 2022, 1:41pm UTC](https://forums.unrealengine.com/t/android-broadcast-receiver-autostart-app-on-boot/433572/3 "2022-08-10T13:41:27Z")

</div>

I am als trying to acheive this. I want my application to start on boot, I’ve tried packaging this in within my src android folder:

I’m not sure if this will work, but I also cant add this to the manifest as it gets overwirtten when I package, I can add in permissions etc within UE5 editor ‘project settings’, but there is no section for ‘Extra Tags for ’ or something along those lines

```auto
package com.example.UE5_Project;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * You should start your derived downloader class when this receiver gets the message 
 * from the alarm service using the provided service helper function within the
 * DownloaderClientMarshaller. This class must be then registered in your AndroidManifest.xml
 * file with a section like this:
 * <receiver android:name=".AlarmReceiver"/>
 */
public class BroadcastReceiverOnBootComplete extends BroadcastReceiver {
 
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equalsIgnoreCase(Intent.ACTION_BOOT_COMPLETED)) {
            Intent serviceIntent = new Intent(context, UE5_Project.package);
            context.startService(serviceIntent);
        }
    }
}

```
