# API LEVEL 34 java.lang.SecurityException: One of RECEIVER\_EXPORTED or RECEIVER\_NOT\_EXPORTED

**URL:** <https://forums.unrealengine.com/t/api-level-34-java-lang-securityexception-one-of-receiver-exported-or-receiver-not-exported/1889544>\
**Category:** Programming & Scripting\
**Tags:** apk, mobile-device, unreal-engine, crash, question\
**Created:** [June 4, 2024, 6:01pm UTC](https://forums.unrealengine.com/t/api-level-34-java-lang-securityexception-one-of-receiver-exported-or-receiver-not-exported/1889544 "2024-06-04T18:01:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Milly01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Milly01](https://forums.unrealengine.com/u/Milly01)\
**Post date:** [July 5, 2024, 1:50pm UTC](https://forums.unrealengine.com/t/api-level-34-java-lang-securityexception-one-of-receiver-exported-or-receiver-not-exported/1889544/2 "2024-07-05T13:50:09Z")

</div>

I’m currently having the same problem. I am in the middle of testing it, but I believe this will work:

In Engine\Build\Android\Java\src\com\epicgames\ue4\GameActivity.java.template (this .template file is used to construct the actual GameActivity.java file that gets packaged)

you can see the call to registerReceiver that is causing the problem in onStart()

```auto
registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN));

```

You’ll also see that it is only added in non-shipping builds for receiving console commands, so I think RECEIVER\_EXPORTED is the correct option to use here, it just needs adding as a third parameter to the registerReceiver call.

I’ve wrapped it in a targetSdkVersion check to be on the safe side, but it isn’t strictly neccessary. Just replace the current call to registerReceiver with this:

```auto
            try 
			{
				PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
				targetSdkVersion = packageInfo.applicationInfo.targetSdkVersion;
			}
			catch (PackageManager.NameNotFoundException e) 
			{
				Log.debug(e.getMessage());
			}
			if ( targetSdkVersion >= 34 )
			{
				registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN), RECEIVER_EXPORTED);
			}
			else
			{
				registerReceiver(consoleCmdReceiver, new IntentFilter(Intent.ACTION_RUN));
			}

```

Cheers,  
Matt

---

_[View the full topic](https://forums.unrealengine.com/t/api-level-34-java-lang-securityexception-one-of-receiver-exported-or-receiver-not-exported/1889544)._
