question

1807605288 avatar image
1807605288 asked

Android Plugin Upgrade Discussion

This is an open discussion about the pending Unity Android Push Plugin changes.

Please list concerns, requests, and feedback here.

unity3dPush Notificationsandroidfeedback
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

robert avatar image
robert answered

Update plan sounds great, really appreciated (we receive a ton of crash reports currently).

One concern:
If possible please don't require a newer appcompat, appsupport or google play libraries as used with the current plugin. Many Unity projects are already on the DEX 64K limit and updating these libraries is often not possible.

12 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1807605288 avatar image 1807605288 ♦ commented ·

This may not be ready by the advertised release of UnitySdk v2.22:

We plan to have multiple versions of the plugin available, for different versions of the GooglePlayServices dependencies. We've resurrected our older GooglePlayServices 8.4.0 and it will get the same bugfixes and upgrades as 10.0.1. Once this effort is all finished, we hope to support a handful of versions of GooglePlayServices. If you have a specific requested version, let us know.

0 Likes 0 ·
robert avatar image robert 1807605288 ♦ commented ·

In our case we are using Unity 5.6, GPS 10.0.1, appcompat-v7.24.0.0 and support-v7-24.0.0. (we can't upgrade to appcompat-v7-25.x for instance because this version added a lot of DEX references where we have absolutely no chance to reduce these references without risking device/firmware incompatibilities).

Thanks!

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ 1807605288 ♦ commented ·

Your case IS on the backlog list I hope to get to eventually, but I can't say when, or if I'll get to it.

After the release of PlayFab UnitySDK v2.22, you might want to take our GPS 10.0.1/Support25.0 plugin from this folder:
https://github.com/PlayFab/UnitySDK/tree/master/AndroidPluginSrc
Update the dependencies to match your circumstances, and build the plugin yourself.

At the time I'm writing this, there are issues with scheduled notifications, and the C# to Java interface will need to change to fully support them, so keep that in mind. (This is why we didn't launch the first batch of fixes today)

0 Likes 0 ·
robert avatar image robert 1807605288 ♦ commented ·

Thanks for the information. Is there any special reason/method why you require support 25.0 libraries?

0 Likes 0 ·
Show more comments
mattilange avatar image mattilange commented ·

Are there any news about the release of the Android Plugin? Kind regards, Matthias

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ mattilange commented ·

TODAY! I'm starting the automated build right now, it'll be up in a couple hours.

1 Like 1 ·
Chris avatar image Chris commented ·

Hi !

This is tremendous news, as I haven't been able to use the notifications in last versions...

But one question though... From your upgrade guide, I read that you only support android 7.1 ?

Will it crash on older devices, or be ignored ? Should we preprocess our code depending on the android version to avoid trouble ?

We can't just change our targeted devices like that, so I'm looking for the best way to still use the plugin...

For info, we are targetting 4.1+ so far.

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ Chris commented ·

For now, we only support Android 7.1.
We intend to have multiple plugin downloads for multiple Android and dependency versions. This is still in progress, and we don't have an ETA yet.

0 Likes 0 ·
mattilange avatar image mattilange commented ·

Great news about the plugin,

the Android version (>=7.1) issue gives me headaches though. Does it mean that 95% of the current devices are excluded? (see API level stats: https://developer.android.com/about/dashboards/index.html). That would make it pretty unusable for us...

On a sidenot: Waiting for the new plugin I did some experiments with the Firebase Messaging SDK for Unity. I'm abled to receive PlabFab Push Notification inside a Unity application with it, but it seems that the protocol is a bit different. Message content and the title of a notification send by PlayFab are somehow stored in the data section of the message received by Firebase. That prevents that a notification is triggered in case the app is closed. Is there somekind of workaround for that?

Thanks and kind regards,
Matthias

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ mattilange commented ·

We will back-port this to older versions as soon as we can. All of our source code for the plugin is public here so you could probably do that for yourself if you're in a hurry, since you're clearly familiar with Android.

The bulk of the plugin is for advanced support such as scheduling, delivery to the unity callback, icons, sounds, customData, etc. If you want the simplest and dirtiest solution, you can strip it down to just the GCM initialization and token-fetching part.

Or you can wait a few weeks, and we'll get to more versions of android and the other dependencies.

1 Like 1 ·
robert avatar image robert 1807605288 ♦ commented ·

Same here unfortunately. Excluding all Android 4.1 - 7.0 players "just" for push notifications doesn't work for us, we will wait until older android versions are support too.

0 Likes 0 ·
1807605288 avatar image
1807605288 answered

We just got a second version/package uploaded. It's available in the master branch now, and will be "official" in the versioned branch in the next version of the SDK. (You can use it now, it's finished)

https://github.com/PlayFab/UnitySDK/tree/master/Packages

The new one is Google Play Services 8.4.0, appcompat-v7-24.2.0, support-v4-23.4.0, API 24.

We will review this thread Tomorrow, June 7, 2017, to determine which version combination is next highest priority.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1807605288 avatar image 1807605288 ♦ commented ·

@robert

This isn't EXACTLY your version, but we have one plugin on either side of your intended version, and all the PlayFab code is exactly the same. So, if we're lucky, you should be able to just take AndPlug_8.4.0-release.aar, PlayFabAndroidPushPlugin.cs, and AndroidManifest.xml from the 8.4.0 plugin, and use it as-is with your project. Please let us know if this works for you.

0 Likes 0 ·
1807605288 avatar image
1807605288 answered

https://github.com/PlayFab/UnitySDK/blob/master/Packages/README.md

After lots of testing, I've determined what we can do, and what we're not likely to do.

PlayServices version: First, the two supported versions of Google Play Services are 8.4.0 and 10.0.1. If you require any either of these versions specifically, then you can use the plugin provided. Any unlisted version after 8.4.0, then you're probably going to have to build the plugin yourself, using our public source.

API Version: Our plugins work with API 25 out of the box. The 10.0.1 plugin comes with appcompat-v7-25.1.1.aar. If you wish to target API 21-24, then you need to replace the appcompat file with a version matching your Android API target version. For example, if you wish to target API 21, you need to retrieve appcompat-v7-21.0.3.aar from your own AndroidSDK, remove appcompat 25, and replace it with yours. We can't get API 16-19 to work, so you have to stick with Lollipop (API 21) or higher, or not use our push plugin.

We will not be publishing any additional plugins targeting older versions of any dependencies described. According to the Google Developer Dashboard, at the time of writing this post, API 21 and higher represents 71.5% of the Android market.

You should rebuild your own plugins to define min version as 21 and higher to match, and ensure compatibility and buildability.

Please share if you have any additional questions or concerns.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

robert avatar image robert commented ·

Thanks for the info, unfortunately we still target API level 16 with Google Play Services 10.0.1 and appcompat-v7-24.0.0

Do you mind posting why you can't support API 16? (which features/APIs are missing there you need?)

Any, if you say you can't support API 16, will the plugin crash or just silently "exit"? (Would could definitely live with push not working on API 16 - 21, but it still should link and disable itself when launching)

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ robert commented ·

While trying to support just API 19, we had to strip out the newer classes, crippling the plugin. We could not find working documentation for replacing the missing parts with Pre-21 mechanisms. All the Stack Overflow answers for the errors and issues we were seeing all say "update to 21+".

In short, we can't find any way to go backwards, because it's all deprecated. Google's official answer is "use the latest version".

API 16-18 only represents 8.8% of the Android market, and I think it's safe to assume that's not the best target market for in-app-spending.

I personally really hoped to support KitKat, since it represents 18.1%, but I just don't know how to do it. I've sunk several weeks into this effort, and "best bang for the effort" turned out to be: API 21+, and the better 71.5% of the total market. It's not perfect, but it's pretty good. If you're very skilled at targeting API 16, you can probably take our plugin source and make it work for you. If not, then you can still use our push notification APIs without our plugin: you only lose the icon/sound/customData parsing.

0 Likes 0 ·
info-9 avatar image
info-9 answered

Thanks for the effort you put into making the push functionality working. I'm curious about your suggestion to use the Playfab API without the plugin, because I dont need the additional functionality. The only thing I need is that a text message appears in the clients push notification area (so no icon, sound, customData parsing, no advanced things like sheduling or receiving the message in-game). I would be nice to have instructions on that (like a "minimum guide for minimum functionality").

What I learned from your existing guides is how to set up android push notifications in the playfab game manager by delivering the server key from the firebase project. And how I can register a client via ClientAPI/AndroidDevicePushNotificationRegistration. But there are two open points I didn't find information about:

  • How do I obtain the client device token that I report via AndroidDevicePushNotificationRegistration ?
  • Your docs say "Developers are free to implement their own push listener client". Since I am new to this topic I dont know what a "push listener client" is, but it sounds like the component that receives the messages (and maybe forwards them to the app). Do I need this for the described reduced functionality? And if yes, what is the easiest way to go?
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1807605288 avatar image 1807605288 ♦ commented ·

EASIEST PATH: You should note, you can still send unscheduled, plain, unstructured, no-sound icons using our plugin. The easiest way to go is definitely to just use our PlayFab push plugin, especially if you don't have any conflicting plugin version dependencies.

Making your own plugin should be considered Android-Expert-Only. I wasn't completely clear about that earlier. I know approximately what you have to do, but I haven't taken those steps yet, so keep in mind, the instructions below may be incomplete.

0 Likes 0 ·
1807605288 avatar image 1807605288 ♦ commented ·

In the end, you'd be taking our plugin, using about HALF of it as a reference guide, and then creating your own push plugin, that matches the exact dependencies for your other plugins. You should only do this if you're unable to match the dependency requirements for the PlayFab Push Plugin.

0 Likes 0 ·
info-9 avatar image info-9 1807605288 ♦ commented ·

Ok, thanks for clarifying that. I see, thats not a way I can go, since I don't have the required Android experience (im developing in C#/Unity). Nevertheless I'm worried about the tradeoff when using your plugin (due to minSDK and the dangerous permissions in the manifest). So I had a look around and tried the Firebase Messaging Plugin for Unity. The good thing about it is, that it works with minSDK=16, so it not only supports KitKat with its 18% of the Android market, but even the 8.8% for JellyBean. And it doesnt have the dangerous permissions READ_PHONE_STATE, GET_ACCOUNTS and VENDING.BILLING. Instead it has ACCESS_NETWORK_STATE, but thats only a normal permission. But its a pity that I don't get it to receiving push notifications from Playfab (I've asked a seperate question on that problem to not go too far offtopic here in this thread).

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.