Is there any documentation/write-up on this? I see it pop up in the AndroidManifest.xml some times, and more than a few plugins use it, and it’s accompanying partner in crime,
Which like “UnityPlayerProxyActivity” show no results when you search the documentation area of the site. I have a fair enough idea about what this probably is, and would very much like to be able to take advantage of it, but without knowing how to implement it myself, I’ve no idea how I might bring it in to my own plugins.
I’d also love to know if there’s an equivalent on iOS.
UnityPlayerProxyActivity is a deprecated activity. It was used in Unity 3.x to switch between the NativeActivity and a regular Activity depending on the device capabilities i.e. Froyo and Eclair devices would fallback to a regular activity while all other devices would run a NativeActivity.
So, is it deprecated, and has no use at all, or marked as to be deprecated in the future? Because two of the plugins we’ve paid for have the UnityPlayerActivityProxy as metadata in the AndroidManifest.
It’s deprecated and has no use. We still ship it but it will always dispatch to the same activity since we no longer support Eclair and Froyo. I’m guessing some plugins still use it to keep Unity 3.5 compatibility. We have no current plans of removing it but at some point in the future we will probably get rid of it completely.
If they were there, but are now deprecated, that needs to be doc’d somewhere, so I know that if we get a plugin that adds that sort of thing, I can safely just remove it, but also just have a better understanding of the system, in general.
a meta-data tag has nothing to do with anything on Android. You can make them up and stick them in the AndroidManifest all you want and it will have no effect.
Can Unity staff answer this? I don’t know why they don’t implement it so developers can integrate multiple plugins without having to extend Unity native activity (That is the source to 90% of problems).
Why it’s still getting ignored? It affects every project that has to mix 2 o more plugins that extend from Unity native activity and don’t have source code.
I have the impression that Android platform has much less attention that iOS and that’s not ok.
For example, in Unity iOS has it’s own namespace with Notifications, Social APIs, etc… Now with iPhone 6 it has new touch APIs…
On Android we have almost nothing in APIs.
We should have Notifications and Game platform APIs like IAP cross platform API.
@bdovaz I know you said you didn’t like the fragment approach but even if we did add some built-in support for this it would most likely be an implementation based on fragments. Also, since this can be done without the help of custom Unity classes I generally think that is a better solution.
That said, something I personally think would be nice is to have c# hooks for some of those functions. That way plugin developers can write stuff in c# without the need of adding java code. But this is not something we currently have planned.
A fragment lifecycle it’s not the same as the activities and the callbacks neither.
In an activity you can receive for example an “OnNewIntent” (really useful to use custom schemes) and on a Fragment you can’t receive this from the Activity that is hosted in.
And there are more examples like this.
The best approach @bitter it’s to implement Prime31’s “Activity Sharing”:
Also your C# approach it’s only valid for methods like “onPause” and “onResume” (and also already implemented by MonoBehaviour’s OnApplicationPause/Resume) that has no parameters but there are many methods with parameters that it’s more interesting to have access directly on the java side because it’s more likely to use them for other operations and not on C# side.
I had a very strange issue when I was pressing “home” or “window management” android buttons from my game and then starting the game from icon from the desktop. The game seemed to restart but it was crashing because of a “leaked” dialog from a custom activity (specified in the androidmanifest.xml file). I was using only the UnityPlayerActivity activity. Once I inserted back the com.unity3d.player.UnityPlayerProxyActivity activity, pressing the icon button restarted the game properly.
In my case, having UnityPlayerProxyActivity in the androidmanifest.xml helped me.