# Platform specific functionality in UE4 game?

**URL:** <https://forums.unrealengine.com/t/platform-specific-functionality-in-ue4-game/294640>\
**Category:** Mobile\
**Tags:** ndk, unreal-engine, api, Android, java, question\
**Created:** [September 26, 2014, 2:54pm UTC](https://forums.unrealengine.com/t/platform-specific-functionality-in-ue4-game/294640 "2014-09-26T14:54:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimitrov](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dimitrov](https://forums.unrealengine.com/u/dimitrov)\
**Post date:** [September 26, 2014, 2:54pm UTC](https://forums.unrealengine.com/t/platform-specific-functionality-in-ue4-game/294640/1 "2014-09-26T14:54:57Z")

</div>

Fellow inspired game creators,

Is it possible to add some platform-specific code and functionality to a multi-platform UE4 game?  
For example, on Android if I want to start another application from inside the game.  
Or let’s just say if I want to talk to the Android API’s that are normally used by Android app developers.

Normally an Android app can have both Java code and native (C++) code, so I suppose this should be technically possible.

Cheers!

---

<div class="post-metadata">

**Author:** ![joshbadams](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joshbadams](https://forums.unrealengine.com/u/joshbadams)\
**Post date:** [September 26, 2014, 3:10pm UTC](https://forums.unrealengine.com/t/platform-specific-functionality-in-ue4-game/294640/2 "2014-09-26T15:10:57Z")

</div>

Adding Android functionality isn’t really the hard part - it’s usually how to get to it from your game. Assuming you are using full source (GitHub) then it’s not hard to add functionality. Here’s how you would add something to Java, let’s call it DoStuff:

- Add a DoStuff function to GameActivity.java that you want called from C++
- Add a “thunk” method variable in AndroidJNI.h and .cpp, called AndroidThunkJava\_DoStuff
- In JNI\_OnLoad in AndroiJNI.cpp, find the function with GetMethodID and your function signature (something like “(Ljava/lang/String;)V” if your function took a string and returns nothing.
- Add a global C++ function to AndroidJNI.cpp called AndroidThunkCpp\_DoStuff(const FString&)
- Have it call the java method with CallVoidMethod, passing it the string like AndroidThunkCpp\_LaunchURL does
- Now extern AndroidThunkCpp\_DoStuff and call it from wherever you need (this is very game specific)

TL;DR: Look at LaunchURL and how it’s handled in AndroidJNI.cpp and GameActivity.java

Note that I have locally cleaned up some of the JNI code to make it more readable and some other tweaks, so in 4.6 the code you added to AndroidJNI.cpp will need to change a little bit - nothing outlandish tho.

Josh

---

<div class="post-metadata">

**Author:** ![dimitrov](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dimitrov](https://forums.unrealengine.com/u/dimitrov)\
**Post date:** [September 28, 2014, 8:29pm UTC](https://forums.unrealengine.com/t/platform-specific-functionality-in-ue4-game/294640/3 "2014-09-28T20:29:50Z")

</div>

Thanks! I’ll definitely look into this!

---

<div class="post-metadata">

**Author:** ![Semen\_Sechenev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Semen\_Sechenev](https://forums.unrealengine.com/u/Semen_Sechenev)\
**Post date:** [September 1, 2015, 1:54pm UTC](https://forums.unrealengine.com/t/platform-specific-functionality-in-ue4-game/294640/4 "2015-09-01T13:54:45Z")

</div>

Hi Josh! Could you please answer question [How to force packager to rebuild AndroidJNI dll? - Mobile - Epic Developer Community Forums](https://answers.unrealengine.com/questions/294690/how-to-force-editor-to-rebuild-androidjni-dll.html)

---

<div class="post-metadata">

**Author:** ![panha](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@panha](https://forums.unrealengine.com/u/panha)\
**Post date:** [February 5, 2017, 4:41pm UTC](https://forums.unrealengine.com/t/platform-specific-functionality-in-ue4-game/294640/5 "2017-02-05T16:41:08Z")

</div>

Hi guys! could you please help me in this part,

> **[Read Android intent extra data on Unreal app launch](https://forums.unrealengine.com/questions/558437/read-android-intent-extra-data-on-unreal-app-launc.html)**
>
> I am trying to launch an Unreal application from a website with a provided URL. I cannot figure out how to read the intent extra data in Unreal. I need this, in order to performs different actions based on the data that is provided with the link. ...

---

<div class="post-metadata">

**Author:** ![Omar\_Vector](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Omar\_Vector](https://forums.unrealengine.com/u/Omar_Vector)\
**Post date:** [November 7, 2018, 5:01am UTC](https://forums.unrealengine.com/t/platform-specific-functionality-in-ue4-game/294640/6 "2018-11-07T05:01:16Z")

</div>

I know its quite old topic, but is that possible to access audio mic directly within android API this way?
