- Home /
Regarding Unity's Main Android Activity
I saw three classes(UnityPlayerNativeActivity, UnityPlayerActivity, UnityPlayerProxyActivity) which are being referred when writing plugins for Android. Even unity's documentation mentioned two classes (UnityPlayerNativeActivity, UnityPlayerActivity) with out mentioning the differences. [http://docs.unity3d.com/Manual/PluginsForAndroid.html]
However, Once I see the .java files came up with the Unity app, I see UnityPlayerActivity termed as deprecated. So Can I expect only to refer and extend "UnityPlayerNativeActivity" from now on when writing plugins?
Can anyone please confirm on this? Very much thankful to anyone who helps.
Answer by Yury-Habets · Dec 12, 2014 at 06:27 PM
This is a good question.
In 4.5 and 4.6, UnityPlayerNativeActivity is the default activity. In 5.0, starting from b12, UnityPlayerActivity is back and again the default activity.
The difference is simple - UnityPlayerNativeActivity extends NativeActivity, while UnityPlayerActivity extends Activity :)
Hope that helps>
Hi thanks for the answer. but UnityPlayerActivity is extending UnityPlayerNativeActivity :|
Im using 4.6 unity btw. Please update your answer after cross checking once.
I thought I'm giving you some useful insight into how this will look like in 5.0...
In 4.5 and 4.6 for backwards compatibility UnityPlayerActivity is extending UnityPlayerNativeActivity. So if some pre-4.3 projects are using UnityPlayerActivity, they will still work but in fact use the native activity.
In 5.0, we plan to get back to Java activity ins$$anonymous$$d of native activity, meaning that UnityPlayerActivity which extends Activity will be the default one.
Thanks for the update Yury. So If im writing a plugin which will be distributed to others, which class file I need to extend?
@Yury - is there any benefit from deriving one over or the other when creating a custom activity for our game?
@liortal, we don't see a clear benefit of native activity vs. Java activity as for now. It uses different input techniques, and native activity has more (let's say) compatibility issues - this is the reason why we switched to Java activity. I would say - use a Java activity if possible. For more recommendations, please refer to Google documentation.
Your answer
![](https://koobas.hobune.stream/wayback/20220613173856im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Turn your Android device webcam (Camera) , flash light 3 Answers
android - native twitter connect 0 Answers
FileNotFoundException: Could not find file MyProject\Temp\StagingArea\AndroidManifest.xml 0 Answers
How to access an Android native plugin in unity ? 0 Answers
Android Permissions API Version 1 Answer