Search Unity

[RELEASED] UTNotifications - Professional Cross Platform Push Notifications and More

Discussion in 'Assets and Asset Store' started by Yuriy-Ivanov, Jun 12, 2015.

  1. cutoren

    cutoren

    Joined:
    Mar 4, 2014
    Posts:
    4
    HI Yuriy,

    Another question here. I am not sure about how is the show notification WHEN_CLOSED_OR_IN_BACKGROUND working (as well as ALWAYS). The scheduled notifications is working fine when the process is not killed (force stopped).

    The notification is working fine, either in background, or even triggered Application.Exit(). However, the notification is not working when the application is forced stopped.

    I want to have my application firing notification like how alarm application does. For example, when you set an alarm via clock application, you can force stop the clock application with the alarm still working in background (where I believe they develop clock application with the service class). Is your UTNotification plug-in able to do the same thing? Or am I doing something wrong here?

    Thanks in advance.
     
  2. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi cutoren,

    Yes, we use a background service, and everything worked on my Android device even after forced stopping. Can you please tell me which device and what version of Android do you use to reproduce an issue? And also, please tell me what do you do to force stop an app? Swiping it from the recent apps list? Stopping it in the Android system settings? Killing it from command line? Something else?
     
  3. cutoren

    cutoren

    Joined:
    Mar 4, 2014
    Posts:
    4
    Hi Yuriy,

    It is tested using XIAOMI 3, with OS Android Kitkat 4.4.4 ktu84p.

    Swiping it away from the recent apps list is what I have done.

    Sorry but I guess it might be some silly mistake I have made somewhere.
     
  4. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi cutoren,

    I did some tests on both Android 4.4 & Android 5. Swiping an app away from the recents list doesn't prevent scheduled notifications. But killing it manually in the system settings does, but I'm afraid we can't do anything with it (Android kills all the app-owned background services and registered alarms).
    Probably Android version by XIAOMI does such a deep kill on swiping away.
     
  5. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Glad to inform, that UTNotifications 1.5 has beed finally uploaded to the Asset Store. It will be available in about a week or two when Unity will approve it.

    Main changes:
    - API for handling clicks on system notifications
    - Windows Store build doesn't require Unity 5.0+ anymore
    - TimeUtils added
    - Minimal supported version changed to 4.5
     
  6. ClementTodd

    ClementTodd

    Joined:
    Jun 16, 2015
    Posts:
    3
    I've been encountering an issue where sometimes, the title and text of the push notification appear blank. I receive the push at the correct time, but the body is empty. Is this a known issue? I can't seem to determine a cause as it happens randomly.
     
  7. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi ClementTodd,

    No, you are the first one to report about such issue. What push services are affected? What devices with what version of OS? Please also tell me what do you use on a server side, because it can be a server-side issue.

    Thank you and best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Dec 23, 2015
  8. ClementTodd

    ClementTodd

    Joined:
    Jun 16, 2015
    Posts:
    3
    I also suspect that the issue may be on our server side, but I wanted to make sure that this wasn't something with a known solutions already. The affected devices seem fairly random; it happened first on an HTC One with Android 4.2.2 and then stopped, then started happening on a Samsung Galaxy S5 a week or so later. The only thing that we are doing with UTNotifications is receiving push notifications sent from our server via Google Cloud Messaging.
     
  9. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    I'm glad to inform you, that UTNotifications 1.5 is now available in the Asset Store.

    There is one known issue: with Unity 5.3 it can't automatically create a default AndroidManifest (Assets/Plugins/AndroidManifest.xml) if it doesn't exist yet. It will be fixed in the upcoming update, the current workaround is to manually create that file with the following contents:
    Code (Boo):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0" xmlns:amazon="http://schemas.amazon.com/apk/res/android">
    3.   <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
    4.   <application android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
    5.     <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
    6.       <intent-filter>
    7.         <action android:name="android.intent.action.MAIN" />
    8.         <category android:name="android.intent.category.LAUNCHER" />
    9.       </intent-filter>
    10.       <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    11.     </activity>
    12.   </application>
    13.   <uses-permission android:name="android.permission.INTERNET" />
    14.   <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    15.   <uses-permission android:name="android.permission.VIBRATE" />
    16.   <uses-permission android:name="android.permission.WAKE_LOCK" />
    17. </manifest>
     
  10. hattori

    hattori

    Joined:
    Oct 18, 2014
    Posts:
    21
    Hi there,

    I'd like to ask a question before buying this asset.
    I've been using one of the other unity asset to use local notification but the asset overrides AndroidManifest.xml file resides in Assets/Plugin/Android folder automatically without notice so my settings in the file gets messed up.
    That really annoys me...cannot stand anymore.

    Does this asset override the Assets/Plugin/Android/AndroidManifest.xml file ?

    Cheers
     
  11. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi hattori,

    UTNotifications doesn't override, but automatically patches the Assets/Plugin/Android/AndroidManifest.xml file, and does it not all the time, but only when you change something in its settings. So it keeps all your contents in the manifest, but adds there some additional required declarations.
    Unfortunately you can't avoid that changes in the AndroidManifest.xml, and f.e. an official Facebook plugin does it the same way as UTNotifications.

    Feel free to ask anything here or by support email (universal.tools.contact@gmail.com), we are always happy to assist.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Jan 6, 2016
  12. hattori

    hattori

    Joined:
    Oct 18, 2014
    Posts:
    21
    Hi, Mr. Ivanov.

    Thank you for your quick reply.
    Okay, I understand that I cannot avoid those changes.
    Glad to hear that this asset patches the xml file only when the settings are updated.
    And it seems the support is quick and helpful so I just bought UTNotification.

    Thanks in advance !
     
  13. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi hattori,

    Thank you, I hope the asset will not disappoint you. And remember - we are always at your service in case of any difficulties.

    Best regards,
    Yuriy, Universal Tools team.
     
    hattori likes this.
  14. hattori

    hattori

    Joined:
    Oct 18, 2014
    Posts:
    21
    Hi, Mr.Ivanov.

    I found "UTNotifications Project Files - Extract Here.zip" in Assets/Plugins/Android folder after importing UTNotification asset.
    What is it for ? Can I remove ?
    I couldn't find any clues about the file in the manual.

    Cheers.
     
  15. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi hattori,

    This archive contains an Eclipse ADT project files for two projects of the UTNotifications Android native plugin. Unfortunately the eclipse project files start with . - so Unity asset packager ignores them when uploading an asset, that's why I had to pack them into that archive.
    You can safely remove it if you don't have an intention to modify the native plugin.

    Best regards,
    Yuriy, Universal Tools team.
     
  16. hattori

    hattori

    Joined:
    Oct 18, 2014
    Posts:
    21
    Hi, Mr.Ivanov.

    Thank you for the reply.
    Okay, I got it.
    I just leave it there. I don't need to modify the native plugin right now though.

    Cheers.
     
  17. hattori

    hattori

    Joined:
    Oct 18, 2014
    Posts:
    21
    Hi, Mr.Ivanov.

    Sorry, again.
    I implemented Local Notification for my app as follows.
    -------------------------------
    bool result = UTNotifications.Manager.Instance.Initialize(false);
    Debug.Log("UTNotifications result = " + result);
    UTNotifications.Manager.Instance.ScheduleNotification(30, "TEST TITLE", "TEST MESSAGE", 1);
    -------------------------------

    I built and played the app on my nexus5x but nothing happened even after 30 secs.
    The app was in background at that time.
    I confirmed the log was "UTNotifications result = True" with logcat. (I couldn't find any errors related to UTNotifications with logcat)
    I haven't touched UTNotificationsSettings so all settings were default.

    https://github.com/playgameservices/play-games-plugin-for-unity has already been installed in my app.
    When I imported UTNotifications asset in my app and built, some classes in Plugins/Android/UTNotifications/libs/android-support-v4.jar were conflicted with some jars of play-games-plugin-for-unity so I deleted Plugins/Android/UTNotifications/libs/android-support-v4.jar. (Then, those conflict errors were gone)
    I'm not sure this caused the problem but just let you know.

    Unity version is 5.1.2.f1
    UTNofications version is 1.5
    I need to use only Local Notification.

    Now, I want to start to debug.
    Could you please tell me what I have to look at the first ??
    If you need more info, please let me know.

    Thank you.
     
  18. hattori

    hattori

    Joined:
    Oct 18, 2014
    Posts:
    21
    Hi, Mr. Ivanov.

    Plz ignore my previous post.
    It worked pretty well after restarting Unity.

    Thanks a million !
     
  19. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi hattori,

    Glad to hear that. But there is a known problem with GooglePlayGames plugin, you'll face it if will try to use Google Cloud Messaging push notifications.
    Here is a solution and a description of an issue.

    1. You have a project, both UTNotifications and GoogplePlayGames assets are imported.
    2. Delete the file Assets/Plugins/Android/UTNotifications/libs/android-support-v4.jar.
    3. Find play-services-gcm-*.aar file of the latest version in your AndroidSDK folder: ${ANDROID_SDK}/extras/google/m2repository/com/google/android/gms/play-services-gcm/<LATEST>/play-services-gcm-<LATEST>.aar. In my case it's ~/android_sdk/extras/google/m2repository/com/google/android/gms/play-services-gcm/8.3.0/play-services-gcm-8.3.0.aar.
    4. Copy that file to the Assets/Plugins/Android/.
    That's it, works!

    And now - an explanation. Android supports java libraries of two formats: .jar (old one, Eclipse ADT & standard Java format) and .aar (new one, Android Studio format). Because of compatibility, UTNotifications use libraries and project files of Eclipse ADT. Google Play Services library is provided by Google in both formats. And in a very different way: .jar contains the whole functionality of Google Play Services, and .aar version is spit to many libraries, each providing a little piece of functionality. The GoogplePlayGames asset removes from a Unity project an old-fashioned .jar library, used by UTNotifications, and copies the required by it .aars. But UTNotifications use one piece of Google Play Services library which is not used by the GoogplePlayGames asset (and so not copied from Android SDK by it): Google Cloud Messaging, which is stored in .aar play-services-gcm-*.aar. What about android-support-v4.jar, GoogplePlayGames use .aar version of it too (in my case, Assets/Plugins/Android/support-v4-23.1.1.aar), but its BackgroundResolver was unable to find and delete an extra copy, used by UTNotifications, so in step 2 you helped it a little.

    Best regards,
    Yuriy, Universal Tools team.
     
    hattori likes this.
  20. hattori

    hattori

    Joined:
    Oct 18, 2014
    Posts:
    21
    Hi, Mr. Ivanov.

    Oh, I see. I would've been stuck without knowing that.
    Thanks for the tip !
    I'll keep in mind.

    Thanks in advance.
     
  21. villeHelin

    villeHelin

    Joined:
    Mar 27, 2013
    Posts:
    40
    Hi!

    Our project for Android is a bit non-standard; one of the plugins we use has its own launcher, and the app has to go through it at the beginning: com.mygamez.common.MyStartActivity - it will then boot com.unity3d.player. UnityPlayerNativeActivity

    But when I click a local notification generated using UTNotifications, it will boot directly to com.unity3d.player. UnityPlayerNativeActivity and thus our app doesn't work. Is there a way to change what UTNotifications sets as launcher?

    Thanks,
    Ville
     
    Last edited: Jan 17, 2016
  22. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi Ville,

    It is bad that the plugin uses it's own separate activity and then switches to UnityPlayerNativeActivity: if it derived the Unity Activity class instead, everything would work with UTNotifications seamlessly as we use the exact class of a Unity current activity, which can be f.e. a custom class derived from UnityPlayerNativeActivity class.

    In your case you'll have to modify UTNotifications Android native plugin code a bit:
    In the file Assets/Plugins/Android/UTNotifications/src/universal/tools/notifications/Manager.java, find a line:
    Code (CSharp):
    1. editor.putString(MAIN_ACTIVITY_CLASS_NAME, UnityPlayer.currentActivity.getClass().getName());
    and replace it with
    Code (CSharp):
    1. editor.putString(MAIN_ACTIVITY_CLASS_NAME, "com.mygamez.common.MyStartActivity");
    Depending on a version of Unity you use, you may have or have not rebuild the UTNotifications Android native plugin manually. You can just try building a Unity project and deploying it to a device. If it helped then that's it, if not - then you'll have to rebuild the native plugin. The easiest to do it using Eclipse ADT, for which we provide project configuration files. You can also use Android Studio, but it may require some additional configuring after importing the Eclipse project of the UTNotifications native plugin. Please tell if you need any help with it.

    Please also note, that with that approach (separate launcher and Unity activities) you will not be able to handle clicks on notifications in UTNotifications as this data will be stored in the intent of an activity to which UTNotifications don't have an access.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Jan 18, 2016
  23. Tyfud

    Tyfud

    Joined:
    May 2, 2013
    Posts:
    3
    Hi,

    Question about using it with .NET.

    I've got a service I've written in C#6 in .NET and am intending to run in Azure in the cloud to have my game engine entirely written in .net, without needing to deal with Unity's .NET being old and outdated.

    As a result, I need a way to send messages describing the gamestate to the unity client when an event has happened that's running in the game engine in the cloud, whether it's on iOS, Android, or even the web player/desktop client.

    Is this the correct library for me to purchase to do that?
     
  24. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi Tyfud,

    No, push notifications are not supposed to be used for a client-server data interaction, they are quite slow, restricted and are not very reliable.

    Best regards,
    Yuriy, Universal Tools team.
     
  25. akoz

    akoz

    Joined:
    May 22, 2015
    Posts:
    1
    Hello Yuriy,

    is it possible to get handle notifications without displaying them in system bar. I tried to hide them using "HideNotification" in "OnNotificationsReceived" handler, but it doesn't help. I still can see notifications in the system bar and "OnNotificationsReceived" works only after tap on the notification.
    Do you have any suggestion?
     
  26. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi akoz,

    Pure data notifications are available on Android & Windows Store, but not in iOS (f.e. see http://stackoverflow.com/questions/5131861/push-notifications-without-alert) - iOS just doesn't invoke any app's code when a notification is received and an app is not running.

    That's why we don't provide pure data notifications in the UTNotifications API (we try to keep it as cross-platform as possible). The fact is that push notifications is not a very good idea for server-client interaction, but if you still want to implement the pure data push notifications on Android or Windows Store only, you may write us to the support email: universal.tools.contact@gmail.com and we'll explain you, what you need to change in the provided native plugins code to achieve requested result.

    Best regards,
    Yuriy, Universal Tools team.
     
  27. Gn0ver

    Gn0ver

    Joined:
    Jun 2, 2015
    Posts:
    2
    Hi Guys,

    I have been implementing UTNotification in an App for the past week now and really loves how it works, especially the simple and cross platform API.

    I do have an issue with iOS though, using the latest 1.5.2 version (haven't tried any other version with iOS before). On Android the OnNotificationClickedHandler works as expected and gives our App the correct call whenever the notification is clicked. On iOS however, the delegate is never called and thus the App never responds to the fact that the user has opened the App using a notification.

    It doesn't matter whether the App has been in the background or completely shutdown, the delegate is never called on iOS. Is this a known issue or perhaps a bug that is introduced in version 1.5.2 ?

    We would greatly appreciate any help!

    Sincerely,

    Geoff
    ThinkSharp
     
  28. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi Gn0ver,

    Sorry for a late answer, Unity just informed me about your message. If you need a help ASAP, please contact us by email universal.tools.contact@gmail.com.

    I've just checked OnNotificationClickedHandler on my iPhone with UTNotifications 1.5.2, and it works completely fine. Could you please tell me your version of Unity & XCode? Please also send us by email or post here contents of the file Classes/UnityAppController.mm (which is generated by Unity and patched by UTNotifications when building XCode project).

    Looking forward to hearing from you to help,

    Best regards,
    Yuriy, Universal Tools team.
     
  29. Gn0ver

    Gn0ver

    Joined:
    Jun 2, 2015
    Posts:
    2

    Hey thanks for your response,

    I'll drop you ASAP an e-mail and let's handle it from there.

    Thanks in advance!

    Geoff
     
  30. nedket

    nedket

    Joined:
    Dec 29, 2013
    Posts:
    1
    Hi,

    This may be a silly question - but I just want to make sure.

    We're thinking of purchasing this, however we note that in apples terms they have the following clause(s)

    5.1


    Apps that provide Push Notifications without using the Apple Push Notification (APN) API will be rejected

    5.2


    Apps that use the APN service without obtaining a Push Application ID from Apple will be rejected


    What does this mean for us if we were to use UTnotification?

    Thanks, and sorry again if its a dumb question.

    Cheers.

    Gday.
     
  31. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi nedket,

    It is absolutely fine: when you enable Push Notifications toggle for iOS in UTNotifications settings, we do both: use APN API & obtain a push application ID, so both rules are followed. And without enabling it, you will be able to use local notifications but not push ones.

    Best regards,
    Yuriy, Universal Tools team.
     
  32. HevyDevy83

    HevyDevy83

    Joined:
    Jan 22, 2014
    Posts:
    12
    Hey Yuriy, first of i wanted to say thanks for the great plugin. The implementation was really straightforward and your documentation is very detailed, so we had no problems at all.
    On thing though, that i would appricate if you could implement it in a future version, is the check for local localizations based on the usual res-folder for most plugins (on Android).

    As you mentioned on the previous page i implemented an additional check for a localization in the postPushNotification-function by adding an additional check like:

    try
    {
    int resId = context.getResources().getIdentifier(title, "string", context.getPackageName());
    if(resId != 0)
    title = context.getResources().getString(resId);
    }
    catch(Exception e)
    {
    }

    It works fine and i think if you implement it somehow like this it is totally optional, but it opens up the possibility for users to define localized xml-files for their game. If there is no strings.xml or the key is not found, the standard-content of title would be used.

    Would also be nice if could implement something like it in a future-version, since we would have to change the plugin again if we update to that version ;)

    But besides this, your plugin is working perfectly. So thanks again for that.

    Greetings,

    Chris
     
  33. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi Chris,

    We thought about localization a lot previously. Unfortunately it's not simple thing, and that's why: I worked on many mobile projects already in several companies and none of them used standard Android res-based localization, which you describe above, because it is Android-only solution. It's not convenient for cross-platform project (and UTNotifications is, indeed, cross-platform solution). It is even more complicated with client-side localization on iOS: APNS supports only its own built-in localization approach as there is no client code called before showing received push notification. But most companies use their own localization solutions. So the largest question was - how to provide some unknown localization system support. Most companies localize notifications that way:
    1. Local notifications' texts are pre-localized (notifications are scheduled with already localized text) by the app.
    2. Push notifications' texts are localized on a server using the locale provided by client when sending registration id to a server.

    We thought about adding an API to attach to external localization system on Android and Windows. The problem is: this approach doesn't support iOS, and each of the rest platforms should have it's own implementation of localization system as incoming notifications handling is being done in special native services (written in Java for Android and C# for Windows) without running any Unity code.

    And you are the first of our clients to actually request client-side localization, that's why we didn't add it yet. But if you're fine with the restrictions described above, you're welcome to create a feature request in our official issue tracking system: https://github.com/universal-tools/UTNotificationsFeedback/issues. We then will be happy to include it to one of upcoming updates.

    Thank you for your feedback!

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Feb 9, 2016
  34. intercodegames

    intercodegames

    Joined:
    Dec 1, 2014
    Posts:
    11
    Hello Yuriy,

    I can´t make notifications on Android to work.

    I never get the registration ID.
    Debugging the device I can see an error:

    02-09 12:50:09.972: E/UniversalTools(6775): Unable to register GCM: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE

    How can I fix it?
    Thanks
     
  35. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi intercodegames,

    It looks like Android manifest wasn't patched succesfully or was overwritten by other plugin. Can you please tell if a file Assets/Plugins/Android/AndroidManifest.xml exists in your project (exactly in that folder, because there are other manifests in other folders, but only this one is important here)? And if yes, please send its content to our support email universal.tools.contact@gmail.com so we will be able to help you solving it ASAP. Please also tell your version of Unity.

    Best regards,
    Yuriy, Universal Tools team.
     
  36. intercodegames

    intercodegames

    Joined:
    Dec 1, 2014
    Posts:
    11
    Hello Yuiry, I've just sent you the AndroidManisfest.xml file.
    Unity version is 5.3.2f1
    Thanks
     
  37. bdominguezvw

    bdominguezvw

    Joined:
    Dec 4, 2013
    Posts:
    96
    Before buying it.

    I see that Google's GCM supports iOS but in your asset manual you don't implement it for iOS?

    https://developers.google.com/cloud-messaging/gcm

    It's a must for us so in the server we only need to implement one API and not two (GCM and APNs).
     
  38. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi bdominguezvw,

    No, we don't support GCM on iOS. But the provided DemoServer shows how you can make server support not just one or two providers, but all four: GCM, ADM, APNS & WNS. And it is quite easy.

    And you're always welcome to ask for any support regarding both client and server sides.

    Best regards,
    Yuriy, Universal Tools team.
     
  39. bdominguezvw

    bdominguezvw

    Joined:
    Dec 4, 2013
    Posts:
    96
    Thanks.

    In our case it should be a PHP server but the DemoServer example provided I think that it's in Java?
     
  40. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    You are right, but there is a number of 3rd solutions for PHP. F.e. you can take a look at APNS-PHP for posting to APNS (iOS), for GCM (Android) php-gcm, for ADM see this example.
    The DemoServer shows a way to support several push providers in the same time, regardless of the server language.
     
  41. bdominguezvw

    bdominguezvw

    Joined:
    Dec 4, 2013
    Posts:
    96
    Thanks, one last question.

    You can handle push notifications with app close, right? Like most games that push notifications that "there are new items" and something like that and then know in Unity if you have open it from a notification and extract data.
     
  42. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi bdominguezvw,

    Yes, we can. See UTNotifications.Manager.OnNotificationClicked.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Feb 12, 2016
  43. bdominguezvw

    bdominguezvw

    Joined:
    Dec 4, 2013
    Posts:
    96
  44. FatIgor

    FatIgor

    Joined:
    Sep 13, 2015
    Posts:
    29
    Hi.

    I'm struggling to get my userData into the iOS push notifications.
    My server is using php to send the notifications, and has a little database holding whether a user is Ios or Android so they know the format to send.

    Android I just use this
    $msg = array
    (
    'title' => $title,
    'text' => $message,
    'sender'=>$sender,
    'value'=>$value,
    );

    $fields = array
    (
    'registration_ids' => $registrationIds,
    'data' => $msg,
    );
    And it is picked up fine on the android device, but I just can't work it out for iOS.

    My notification comes through to iOS fine, with message ok, and it triggers the app, but I am getting an empty dictionary for
    userdata

    I've tried putting it in the 'aps' array, in the 'payload' array and even tried adding a 'data' array into the json, but I'm getting nowhere.

    Any help on how to get userData into my iOS app gratefully received.
     
  45. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi FatIgor,

    As described in the official APNS documentation, any custom data should be stored outside of the "aps" object. See https://developer.apple.com/library...ationsPG/Chapters/TheNotificationPayload.html, section Examples of JSON Payloads. F.e. you can see how our DemoServer puts the "server_message" value to an APNS payload: see a generated "payload" value after the line:
    (Assets/UTNotifications/DemoServer/src/DemoServer/PushNotificator.java, notifyIOS):
    Best regards,
    Yuriy, Universal Tools team.
     
    FatIgor likes this.
  46. FatIgor

    FatIgor

    Joined:
    Sep 13, 2015
    Posts:
    29
    Thank you, the examples link showed me exactly what was needed, which was about the only version I hadn't tried...

    Everything works now, Android and iOS are doing just what I want.
     
  47. rsodre

    rsodre

    Joined:
    May 9, 2012
    Posts:
    229
    Hey guys.

    Awesome plugin, thanks.

    BUT... you should update your docs!
    I lost 2 days hitting my head trying to figure out the play-services-gcm-xxx.aar deal.
     
  48. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi rsodre,

    First of all, thank you!
    We created a task in our internal issue tracking system to provide a FAQ containing solutions for most common issues (which in most cases are caused by some incompatibilities with other assets).

    Meanwhile, in case of any issues don't hesitate to contact us by email or forum - we are always happy to assist!

    Best regards,
    Yuriy, Universal Tools team.
     
  49. rsodre

    rsodre

    Joined:
    May 9, 2012
    Posts:
    229
    Thanks, but it should be part of the installation process as well.
    FAQ is good for exceptions, and this is the new standard.

    I have a quick question.
    I'm using a custom Notification Profile on Android. It's working well for local notifications, but how do I assign it for push?
     
  50. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    It only happens with the GooglePlayGames plugin imported. We actually thought about automating the described above actions in case GooglePlayGames plugin is detected (as we've already automated Facebook SDK related conflict resolution).

    Please refer to the manual, see "Using Notification Profiles (Sounds & Icons Settings)" section.

    Best regards,
    Yuriy, Universal Tools team.