Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

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

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

  1. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @anzz,

    Please see my reply in the email.

    Best regards,
    Yuriy, Universal Tools team.
     
  2. amadden1990

    amadden1990

    Joined:
    May 13, 2016
    Posts:
    2
    Okay so I just switched to this plugin to schedule notifications. Whenever I use schedule notification it only works with a short amount of time but I have it scheduled to appear 2-3 hours away and they never show up unless i reopen the app or move my phone around. I am testing on a galaxy note 10+. I also have a debug call showing the scheduled time in the console which is always correct. That datetime is the same one being used to schedule the notifications. Does the scheduled notifications timeout or sleep? Thanks
     
  3. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @amadden1990 ,

    Scheduled notifications don't timeout, but most likely your issue is caused by one of quite many power saving features in Android, especially I suggest you reading this: https://developer.android.com/about/versions/pie/power.
    UTNotifications registers internal "alarms" in AlarmManager (also, see the note in this article) as it lets apps do something in predefined times in background, even if the app is not running. Alarms are significantly affected by Android's power management, and if Android decides that your app is not important enough to put it to one of the "priority" buckets, then notifications may be delivered with significant delay (it's true for both local and push notifications, but local ones are usually affected stronger). You can also take a look at this article: https://www.samsung.com/us/support/answer/ANS00079037/.

    If I'm right about the reason, you should receive your notifications at some point, but likely significantly later than requested. But if notifications are never shown, I'll need a repro Unity project from you to investigate what's going on.

    Hope it helps.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Jul 6, 2020
  4. kwej

    kwej

    Joined:
    Aug 12, 2017
    Posts:
    2
    I'm looking to upgrade an app to Unity 2019.4 (we have UTNotifications 1.8.2 loaded), but we're seeing a UTNotif errors at build time for iOS:

    Assets/UTNotifications/Src/iOS/IOSManagerImpl.cs(650,39): error CS0618: 'LocalNotification' is obsolete: 'iOS.Notification Services is deprecated. Consider using the Mobile Notifications package (available in the package manager) which implements the UserNotifications framework.'


    Is this resolved in the latest UTNotif package? Or do we need to integrate that Unity Mobile Notifs package? I didn't see mention of it anywhere, and we'd rather not upgrade packages without knowing the upgrade actually addresses a specific issue... so any insight would be greatly appreciated, thanks!
     
  5. shihab37

    shihab37

    Joined:
    Jul 7, 2015
    Posts:
    22

    Hi @Yuriy-Ivanov,
    First of all, thank you for this great plugin. We have been using it for years.

    In our new game, however, I'm having the exact same issue as @anzz
    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. /Applications/Unity/Hub/Editor/2019.4.4f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2019.4.4f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    3. stderr[
    4. D8: Type com.google.firebase.iid.zzbb is referenced as an interface from `com.google.firebase.messaging.zzf`.
    5. com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/shihab/.gradle/caches/transforms-2/files-2.1/a8d5840093588f0ddf1422752232c91b/jars/classes.jar
    Here's the detailed log: https://pastebin.com/XPW9GsLn

    Project Setup:
    Unity 2019.4.4f1
    UTNotification 1.8.4
    Packages:
    External Dependency Manager for Unity 1.2.157
    Firebase App (Core) 6.15.2
    Google Analytics for Firebase 6.15.2
    Firebase Crashlytics 6.15.2​

    If I uncheck the FCM checkbox in UTN settings, the game builds and runs fine without any errors.

    Additional Info:
    I also tried to build after deleting the "PlayServicesResolver" that comes with UTNotifications (because I already have EDM4U package), but the result is the same.

    UTN also replaces "Google.VersionHandler.dll" and "Google.VersionHandler.dll.mdb" files in EDM4U package. This causes the following exceptions

    Code (CSharp):
    1. MissingMethodException: bool Google.VersionHandler.RegisterBeforeAssemblyReloadEvent(System.Action)
    2.  
    3. and
    4.  
    5. MissingMethodException: bool Google.VersionHandler.UnregisterBeforeAssemblyReloadEvent(System.Action)
    Detailed log here: https://pastebin.com/7E8AH5NN

    If I replace these two files with the original ones, these exceptions are gone. I'm guessing these two methods were added recently in EDM4U. Should I keep using the original files that come with EDM or use the ones that come with UTN?
     
    Last edited: Aug 12, 2020
  6. bmorgan-ksg

    bmorgan-ksg

    Joined:
    Dec 13, 2016
    Posts:
    8
    We recently expanded our project to include Firebase v6.15.2 along with External Dependency Manager v1.2.157. While we didn't run into issue when building the project, we did get crashes on first install and when receiving a push notification that looked very similar to those posted above. We were able to resolve this by changing the Firebase version in the Dependencies.xml files:

    UTNotificationsAndroidDependencies.xml
    com.google.firebase:firebase-messaging:20.2.4

    UTNotificationsAndroidMinDependencies.xml
    com.google.firebase:firebase-messaging:20.0.0+

    I'm not certain this will resolve your build issue, but hopefully it helps point you in the right direction.
     
  7. shihab37

    shihab37

    Joined:
    Jul 7, 2015
    Posts:
    22
    Thank you for the hints but sadly it didn't work :(
    UTNotifications already added com.google.firebase:firebase-messaging:20.0.0+ to both files so, as per your suggestion, I tried building by changing version to "20.2.4" and then to "20.2.4+" in UTNotificationsAndroidDependencies.xml but the error remains the same.

    Your setup seems similar to mine [at least Firebase and EDM] I wonder why you are not getting these errors. What version of Unity are you using?
    and I also have FacebookSDK v7.21.1 in my project. are you using Facebook too?
     
  8. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @kwej,

    We're currently working on update addressing this and other issues, related to new versions of Unity and Firebase. Unfortunately there is no fast fix for it, you'll have to wait until we fix it (hope it will be available in several days, but can't guarantee it). The only solution available right, I'm afraid, is to refrain from updating to Unity 2019.4 or 2020, if you can.

    Best regards,
    Yuriy, Universal Tools team.
     
  9. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    @shihab37 @bmorgan-ksg
    It's not very helpful to modify UTNotificationsAndroidDependencies.xml or UTNotificationsAndroidMinDependencies.xml, these 2 files are generated (and overwritten) by UTNotifications when applying any settings - this configuration should be done in the section "Advanced / Android Libs Versions" in UTNotifications' settings in Unity, though I can't guarantee it will help.

    @shihab37 can you please send us to universal.tools.contact@gmail.com a repro Unity project, so we could test and reproduce the issue and find a fix for it asap?

    Thank you.

    Best regards,
    Yuriy, Universal Tools team.
     
  10. bmorgan-ksg

    bmorgan-ksg

    Joined:
    Dec 13, 2016
    Posts:
    8
    We are on Unity 2017.4 LTS and use the FB Plugin, but rolled back to 7.19.2 due to iOS build failures:
    https://github.com/facebook/facebook-sdk-for-unity/issues/455

    A few other things that might help:
    • We use a custom gradle template so that the android library dependencies are defined/resolved there, rather than being kept in the local file system.
    • We execute a custom build command in batchMode, which invokes GooglePlayServices.PlayServicesResolver.ResolveSync(true); before building the project.
    Generally speaking, I find the custom gradle file very helpful when running into these types of build issues as it clearly lists all of the Android dependencies being pulled into the build and where those dependencies originated from within the Unity project. I suspect you'd find a there is a duplicate or incompatible library listed there.
     
  11. shihab37

    shihab37

    Joined:
    Jul 7, 2015
    Posts:
    22
    you are right about custom Gradle file and we also use it for the same reasons.

    You were also right here in that the trick is to use the correct messaging library version especially when there are other firebase modules in the project. I just needed to figure out the correct version for my project. A colleague suggested me to try 20.2.1 and that seemed to work. then I installed FCM package from UPM and noticed that it put v20.1.7 in my mainTemplate.gradle so maybe this is the version that firebase wants in the project. I uninstalled the FCM package and set 20.1.7+ in UTNotification settings under "Advanced/Android Libs Version/Google Play Services" and finally, the build was successful and we are now getting push notifications on device.

    Thank you so much for your help.

    Thank you so much for the help Yuriy but I don't think we need a repro project now that the problem is solved.
    But this whole process of trying to figure out the correct library version was rather painful. Is this information available somewhere from Firebase? I read somewhere that you have to use the same version for every firebase module you have in your project. This seems simpler for Android Firebase SDK but the Unity SDK in my project is using 17.0.0 for Crashlytics, 17.4.1 for Analytics and now 20.1.7 for Messaging.

    so is there a simpler way to find the compatible version information?
     
  12. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @shihab37 ,

    Glad you sorted it. This is a huge problem indeed, for us as well, and unfortunately there is no simple solution. EDM4U tries to automate it as much as possible, but is not doing great work I'm afraid. F.e., we're currently working on an update to fix issues with Unity 2020, and faced new problems with it and EDM4U which prevent us from releasing a fix: see https://github.com/googlesamples/unity-jar-resolver/issues/396.

    Best regards,
    Yuriy, Universal Tools team.
     
  13. Kaiymu_

    Kaiymu_

    Joined:
    Jun 1, 2016
    Posts:
    38
    Hello!

    I'm also facing some issues regarding UTNotifications.
    When the app is running, the push notifications is displayed on Android without issues.
    But as soon as I quit the app / go into another app, I don't receive any notifications?

    Is that normal?

    If not, what can I do to fix that? Is there anything I need to do inside the AndroidManifest (I know it get patched, but I just want to be sure everything went well).
    The activity I'm launching in my AndroidManifest is this one "unity3d.player.UnityPlayerActivity".

    I'm using Unity 2019.4.24f1 and UTNotifications 1.8.4

    Thank you for your help!
     
  14. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @Kaiymu_ ,

    May I know what target device(s) you're testing it against? Specifically, there is a number of devices that kill any non-explicitly-whitelisted applications, including their background activities, as soon as their Android Activities (i.e. visible windows) are finished. See also: https://stackoverflow.com/questions...ith-huaweis-and-xiaomis-battery-optimizations. Fortunately most devices display scheduled and push notifications just fine when the app is closed or hidden normally. In the same time, force-killing apps (f.e. by stopping them in system settings) is designed by Google to prevent any their activity, including receiving and showing notifications, so it's expected behavior on any Android device.

    Please let me know if it's not your case, further research will be needed then - we'll need a repro Unity project in this case.

    Best regards,
    Yuriy, Universal Tools team.
     
  15. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,290
    Hi @Yuriy-Ivanov
    I upgraded project to 2020.1 and UT is causing issues
    Assets\UTNotifications\Src\Settings.cs(1286,69): error CS0619: 'AndroidMinification' is obsolete: 'AndroidMinification enum is obsolete.'

    Please advise
     
  16. MuzaibRanjha

    MuzaibRanjha

    Joined:
    Aug 28, 2017
    Posts:
    6
    Firebase Images are not showing in the notifications.

    Local notifications with Images are working.
     
  17. GO4MG

    GO4MG

    Joined:
    Sep 25, 2017
    Posts:
    3
    Hello,

    I've encountered this problem before on android device. I fixed it, source of issue was payload.
    But on iOS device, I think my payload is not wrong, when app is running background it is working properly.

    My apns payload:

    {
    "aps": {
    "alert": {
    "body": "Egemen wants to play with you"
    },
    "type": "gameInvite",
    "roomId": "104",
    "joinToken": "j7dVdbvZ3S",
    "displayName": "Egemen"
    }
    }
     
  18. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,290
    Hi @Yuriy-Ivanov
    There is no support for 2020.1 even though Unity 2020.2 is alaso available on beta.
    I'd really appreciate if you share the status regarding 2020.1? i really dont want to move to other plugin.
    Thanks
     
  19. faveris_dt

    faveris_dt

    Joined:
    Sep 13, 2017
    Posts:
    6
    Hi @Yuriy-Ivanov

    I've tried to reach you via email and github (https://github.com/universal-tools/UTNotificationsFeedback/issues/132) but got no answer.

    We can't release our application on Microsoft Store because Windows App Certification is failed with these errors:

    I've tried to pass certification on empty project and I have no such issues until UTNotification is installed. I've also made some experiments and discovered that these issues are related to UTNotifications.winmd.

    We are using Unity 2018.4.23f1 but I think it doesn't matter.
     
  20. DryHeat

    DryHeat

    Joined:
    Jul 31, 2012
    Posts:
    3
    I have also tried to contact support through email, but no response. Has anyone been able to get Push Notifications to work on iOS with Unity 2020?

    I recently purchased UTNotifications for a project I am working on, but am having some difficulty getting the push notifications to send to the device.
    I have been using Firebase cloud messaging to send push notifications, but I wanted to be able to send them from my application instead of just from the Firebase console.
    (Ideally, it would be great if UTNotifications could just use firebase to send my iOS push notifications)
    The iOS notifications do work properly when I send them from Firebase console, so I know the APNs auth key and xcode project are configured properly.
    The demo server says.
    << /notify title=Hey&text=Hey&id=1&badge=-1&_NO_CACHE=0.6882899
    >> HTTP/1.1 200 OK
    >> Server: UTNotificationsDemoServer
    >> Content-Type: text/html
    >> Content-Length: 18
    >> Connection: close
    >>
    >> Notified 1 clients

    But I do not get the push notification or any indication of any errors sending them push.
    Am I missing something else?
    I am using Unity2020.1.0f1.
     
  21. Andelusiy

    Andelusiy

    Joined:
    Mar 24, 2020
    Posts:
    4
    Good day, Yuriy! Could you help me to get started with UTNotifications please, I tried to use it, but got some problems with Initializing the Manager`s Instance
    upload_2020-10-30_0-15-37.png


    When Im hitting the play Im getting this error in Console

    upload_2020-10-30_0-16-23.png

    Hope you can help me.
     
  22. Binouze

    Binouze

    Joined:
    Mar 2, 2017
    Posts:
    93
    Hi, I have the following error on the OnPushRegistrationFailed callback on Android :
    Code (CSharp):
    1. java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.myorg.mygame. Make sure to call FirebaseApp.initializeApp(Context) first.
    I'm using UTNotification 1.8.4 with Unity 2020.1.11f1

    PS: I had to change some line of code in Settings.cs to get it work with unity 2020.1:
    //line 1297
    Code (CSharp):
    1. //replaced
    2. EditorUserBuildSettings.androidDebugMinification != AndroidMinification.None ||
    3. EditorUserBuildSettings.androidReleaseMinification != AndroidMinification.None
    4.  
    5. //by
    6. PlayerSettings.Android.minifyDebug || PlayerSettings.Android.minifyRelease

    // line 772
    Code (CSharp):
    1. //replaced
    2. PluginImporter pluginImporter = (PluginImporter)AssetImporter.GetAtPath( assetPath );
    3. if (pluginImporter != null && pluginImporter.GetCompatibleWithAnyPlatform())
    4.  
    5. // by
    6. var assetImporter = AssetImporter.GetAtPath( assetPath );
    7. if (assetImporter is PluginImporter pluginImporter && pluginImporter.GetCompatibleWithAnyPlatform())

    --- EDIT ---

    I added the following code in the onCreate Method of my MainActivity and the error is gone.

    Code (CSharp):
    1. FirebaseOptions options = new FirebaseOptions.Builder()
    2.               .setApplicationId("APP_ID")
    3.               .setApiKey("API_KEY")
    4.               .setDatabaseUrl("URL")
    5.               .setStorageBucket("BUCKET")
    6.               .setGcmSenderId("SENDER_ID").build();
    7. FirebaseApp.initializeApp(this, options);
    I receive the device token, but when I send a push notification to this device, no notification appears.

    The result of the sent notification is {"multicast_id":xxxxx,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"xxxxx"}]}.

    Any idea on how I can make it work ?
     
    Last edited: Nov 10, 2020
  23. eugene-l

    eugene-l

    Joined:
    Jan 22, 2020
    Posts:
    1
    Hi @Yuriy-Ivanov, I use OnInitialized event to determine if user Allowed or not Notifications on iOS, like this:

    Code (CSharp):
    1. Manager.Instance.OnInitialized += OnInitialized;
    2.  
    3. _notificationsManager.Initialize(true);
    4.  
    5. private void OnInitialized()
    6.         {
    7.             Log.Warn($"Manager.Instance.Initialized={Manager.Instance.Initialized}");
    8.             Log.Warn($"Manager.Instance.NotificationsEnabled()={Manager.Instance.NotificationsEnabled()}");
    9.             Log.Warn($"Manager.Instance.NotificationsAllowed()={Manager.Instance.NotificationsAllowed()}");
    10.         }
    I need this to have specific logic which depends on the player's input: does he allow or not Push Notifications from the Native iOS PopUp?

    After testing I figured out that OnInitialized event fires before the Native iOS PopUp is shown to the player, so the Manager.Instance.NotificationsAllowed() is always return false at this point.

    My question is: what is the best practice to handle player's decision after Native iOS PopUp is closed and the plugin has correct (updated) state of Manager.Instance.NotificationsAllowed()?

    Thank you.
     
  24. blastproofgames

    blastproofgames

    Joined:
    Apr 3, 2014
    Posts:
    14
    Hello!

    I'm having some issues with the WSA Certification for push notifications.
    More specifically:

    Code (CSharp):
    1.  
    2. Parameter allNotifications of method HandleReceivedNotifications of type UTNotifications.WSA.INotificationToolsStatic in file C:\Program Files\WindowsApps\TiltingPoint.MyWSAApp_1.1.3.0_x64__85kh3h6wfjavg\UTNotifications.winmd references the non-Windows Runtime type UTNotifications.WSA.Notification. Windows Runtime types can reference only Windows Runtime types.
    3. The type UTNotifications.WSA.Notification referenced by type UTNotifications.WSA.INotificationToolsStatic in file C:\Program Files\WindowsApps\TiltingPoint.MyWSAApp_1.1.3.0_x64__85kh3h6wfjavg\UTNotifications.winmd was not found. All types referenced in metadata files must be discoverable.
    4. The type UTNotifications.WSA.Notification referenced by type UTNotifications.WSA.INotificationFactory in file C:\Program Files\WindowsApps\TiltingPoint.MyWSAApp_1.1.3.0_x64__85kh3h6wfjavg\UTNotifications.winmd was not found. All types referenced in metadata files must be discoverable.
    Any ideas?
     
  25. Kujo87

    Kujo87

    Joined:
    Sep 16, 2013
    Posts:
    143
    Hi @Yuriy-Ivanov,

    Is this asset being supported any more? It has doesn't seem to work great with Unity 2020.x. quite a few errors and warnings and doesn't compile on iOS properly any more.
     
    jGate99 likes this.
  26. Kujo87

    Kujo87

    Joined:
    Sep 16, 2013
    Posts:
    143
    Seems very much like this plugin is dead... I've tried implementing the new mobilenotification package from Unity to make iOS work, as I don't have an issue with Android, but it just crashes when I receive a push for some reason. hard to track down as it just gives me a SIGABRT rather than anything useful
     
  27. Kujo87

    Kujo87

    Joined:
    Sep 16, 2013
    Posts:
    143
    Ok - made a lot of progress on this today - pretty close to having it all working again (at least for the way I'm using it) - I'll share the class when I'm done
     
unityunity