Unity android dev team, where are you? We need new APIs

After seeing this thread not being answered by Unity staff (I think it’s a really important matter):

I have some thoughts about Android features that should exists almost from the beginning of adding Android to Unity.

  1. iOS has GameCenter implemented:

Why there is no cross platform API? In Android we have this developed by Google:

https://github.com/playgameservices/play-games-plugin-for-unity

  1. iOS has notifications (local/remote) implemented:

http://docs.unity3d.com/ScriptReference/iOS.NotificationServices.html

Why there is no cross platform API?

  1. iOS plugins have an inspector where you can specify which framework depend on.

Why in Android clicking on a “*.jar” can’t have a similar inspector where we could check if it depends for example in “app-compat”? Now we need to copy all “appcompat” folder from SDK if we need for example to use “Theme.AppCompat.Light” to have Material Design compatible with API Level 10.

1 Like

The official Google way to solve that problem is to use a Fragment. You can hookup a Fragment to an Activity without the Fragment being part of the layout. Here is a small example of how you can use this:
https://gist.github.com/bitter/74f36e657adf7d458277

The cross platform API currently provided by Unity is
http://docs.unity3d.com/ScriptReference/SocialPlatforms.ISocialPlatform.html

The play-games plugin should hook into that API so you can use it cross platform. I agree the API could be better but this is what we have today. I’m sure we will expand on that API at some point to enhance the feature set.

This is something that Google solved using Gradle and artifact dependencies. And at some point we will switch to Gradle for Unity too. Right now the setup is a bit too volatile and the performance is not super stellar. But this is something that is improving with every new version of the Android Gradle plugin.

@bitter

Thanks for the response. Any word on notifications?

@bitter

Thanks but you haven’t answer the second point (notifications).

I don’t like very much the approach of creating a fragment that doesn’t draw anything. Many times you only want callback for Activity Lifecycle methods (OnCreate, OnActivityResult, …). I don’t know either if we can achieve the same results with a fragment. I mean, from a Fragment we can attach to all activity methods.

I think also, that there is a serious lack of Unity Android documentation on all this matters (for example: fragments approach for callbacks).

Gradle should be adopted. Android Studio 2.0 is really near also.

@Prodigga @bdovaz

Sorry, I meant to address Notifications too but it slipped my mind :frowning:

So far the demand for local Notifications on Android hasn’t been very big and users who want push notifications usually integrate their own solution or use 3rd party plugins.

That being said, lately there have been a renewed interest in local notifications on Android so maybe it’s time I have another look at a Unity implementation for that. As for push notifications, I also think it would be nice if we could provide support for that out of the box in a cross platform way. I’ll take it up with the team and see what they think.

Yes, the Android plugin documentation is in serious need of an update.

It’s not as simple as that. Today we have a custom build pipe that use specific tools where needed. We do this mainly for stability reasons but also for performance. And Gradle is still not stable enough, i.e if we use Gradle a released version of Unity is likely to break whenever Google decide to update their plugin. Which still happens on a frequent basis. The other problem is performance. The Gradle build pipe is not really designed for building Unity apps, which normally have very little Android integration and a huge set of binary assets. Meaning the performance is not really there yet. We are working with Google to make sure when we release our Gradle integration it is as stable and performant as our own custom solution.

Ok, thanks. I’m looking forward to see new Android features on Unity Roadmap (now there is none!!!).

1 Like