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. toddfiore

    toddfiore

    Joined:
    Dec 16, 2016
    Posts:
    12
    We have successfully got Android push notifications to work with Firebase and would like to use Firebase for iOS notifications as well.

    My question is, can we use Firebase with iOS push notifications? In the settings menu I select iOS push notifications but I dont see any Firebase settings under the iOS panel. When I run the program on an iPhone, I successfully generate an APNS token but using this token with Firebase has no effect. Is this just not an option? Can I somehow use the APNS token with Firebase?

    The documentation isn't clear in the manual or Firebases documentation. Do we have to send our request directly to APNS?
     
  2. Yuriy-Ivanov

    Yuriy-Ivanov

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

    First of all, thank you for purchasing UTNotifications!

    FCM is not yet officially supported by our asset on iOS (we rely on APNS on iOS at the moment), though there may be a way to do it. F.e. https://firebase.google.com/docs/cloud-messaging/ios/client states that it's possible to use FCM through APNS, but to tell the truth we've never tried it it, so it's completely up to you. Alternatively, you can just use the plain APNS on iOS, it's not so difficult to handle more that one push notifications provider on a server side, as shown in our DemoServer example.

    Best regards,
    Yuriy, Universal Tools team.
     
  3. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    I just bought UTNotifications and so far it's very easy to use !
    I have 2 questions :

    - On Android notification panel there is a little square grey icon followed by the name of the application and the date at which the notification has been sent. Below that, there is the title, text and the icon defined by the notification profile. Is there a way to set the first little icon ?

    - In UnityEditor I have this message that seems to not be an issue but I rather ask about it.
    Code (CSharp):
    1. WARNING: No compatible versions of com.android.support:support-v4 required by (com.google.android.gms:play-services-basement:8.3.0), will try using the latest version 23.1.1
    2. UnityEngine.Debug:Log(Object)
    3. Google.JarResolver.PlayServicesSupport:Log(String, Boolean)
    4. Google.JarResolver.PlayServicesSupport:ResolveDependencies(Boolean)
    5. GooglePlayServices.ResolverVer1_1:DoResolutionNoAndroidPackageChecks(PlayServicesSupport, String, OverwriteConfirmation)
    6. GooglePlayServices.<DoResolution>c__AnonStorey1:<>m__0()
    7. GooglePlayServices.ResolverVer1_1:DoResolution(PlayServicesSupport, String, OverwriteConfirmation, Action)
    8. GooglePlayServices.PlayServicesResolver:Resolve(Action)
    9. GooglePlayServices.PlayServicesResolver:AutoResolve()
    10. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
    Thanks
     
  4. Yuriy-Ivanov

    Yuriy-Ivanov

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

    First of all, thank you for using UTNotifications!

    Yes, the little grey icon is a small notification icon. It turns into a grey square because Android 5.0+ ignores any color information of small notification icons: transparent pixels stay transparent, any non-transparent pixels, regardless of their color turn white/grey/dark grey (depending on the icon current background). So as your application icon, which is used by default as a small notification icon, is not transparent, it turns into a grey square. To avoid that issue, please configure a notification profile (you may just configure a "default" one), specifying a white+transparent only picture as "Small Icon (Android 5.0+)". For more details on using the notification profiles, please see section "Using Notification Profiles (Sounds & Icons Settings)" of our official manual. You may also take a look at Android official style guide on icons: https://material.io/guidelines/style/icons.html#icons-system-icons.

    This is a known minor issue with Google Play Services Resolver - a library from Google, which we use for resolving google play services libs dependencies on Android. It is completely harmless, please just ignore it (it's annoying, but we can't control this functionality).

    Best regards,
    Yuriy, Universal Tools team.
     
  5. 6565

    6565

    Joined:
    Feb 17, 2013
    Posts:
    19
    Hey, just bought your package.
    When I scheduled a local notification 10 seconds after the user minimized the app, the app crashes, and we see the following exception in logcat:

    Code (CSharp):
    1. 05-04 18:13:32.401 16196-16196/? E/AndroidRuntime: FATAL EXCEPTION: main
    2.                                                    Process: com.jellybtn.godzillio, PID: 16196
    3.                                                    java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/NotificationCompat$Builder;
    4.                                                        at universal.tools.notifications.Manager.prepareNotification(Manager.java:493)
    5.                                                        at universal.tools.notifications.Manager.postNotification(Manager.java:253)
    6.                                                        at universal.tools.notifications.AlarmBroadcastReceiver.onReceive(AlarmBroadcastReceiver.java:14)
    7.                                                        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3041)
    8.                                                        at android.app.ActivityThread.-wrap18(ActivityThread.java)
    9.                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1562)
    10.                                                        at android.os.Handler.dispatchMessage(Handler.java:102)
    11.                                                        at android.os.Looper.loop(Looper.java:154)
    12.                                                        at android.app.ActivityThread.main(ActivityThread.java:6121)
    13.                                                        at java.lang.reflect.Method.invoke(Native Method)
    14.                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
    15.                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
    16.                                                     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.NotificationCompat$Builder" on path: DexPathList[[zip file "/data/app/com.jellybtn.godzillio-1/base.apk"],nativeLibraryDirectories=[/data/app/com.jellybtn.godzillio-1/lib/arm, /data/app/com.jellybtn.godzillio-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
    17.                                                       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    18.                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    19.                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    20.                                                       at universal.tools.notifications.Manager.prepareNotification(Manager.java:493)
    21.                                                       at universal.tools.notifications.Manager.postNotification(Manager.java:253)
    22.                                                       at universal.tools.notifications.AlarmBroadcastReceiver.onReceive(AlarmBroadcastReceiver.java:14)
    23.                                                       at android.app.ActivityThread.handleReceiver(ActivityThread.java:3041)
    24.                                                       at android.app.ActivityThread.-wrap18(ActivityThread.java)
    25.                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1562)
    26.                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
    27.                                                       at android.os.Looper.loop(Looper.java:154)
    28.                                                       at android.app.ActivityThread.main(ActivityThread.java:6121)
    29.                                                       at java.lang.reflect.Method.invoke(Native Method)
    30.                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
    31.                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
     
  6. Yuriy-Ivanov

    Yuriy-Ivanov

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

    I've already replied you be email, but just in case duplicating it here:

    First of all, thank you for purchasing UTNotifications. The exception you're facing means that android support library is missing in your project. Our asset is supplied with Google library Play Services Resolver, which is responsible for resolving android libraries dependencies, including android support library. Usually, it works automatically in background, when Android is selected as a target platform, but in case automatic resolution is disabled in your Play Services Resolver settings or required libraries are not installed with your Android SDK, it can be required to manually request the libraries resolution.
    Please go to Unity main menu, there Assets -> Play Services Resolver -> Android Resolver -> Resolve Client Jars. It should download and store the required Android libs. There should be many .aar files in your Assets/Plugins/Android after that.

    Please also check the Unity console - in case Play Services Resolver fails for any reason, it will contain error messages. Send them to me in that case.

    Best regards,
    Yuriy, Universal Tools team.
     
  7. NicoL3AS

    NicoL3AS

    Joined:
    Oct 7, 2015
    Posts:
    18
    Hello!
    I'm having some trouble on a fresh project with the last version of UTNotifications for Android.
    I carefully read other posts in this thread with similar errors but none seems to match my case.

    In the editor I have these messages:

    I just created a new project, and then import UTNotification inside. I did not touched the AndroidManifest or any of the files. I tried to use Assets > Play Services Reseolver > Android Resolver > Resolve Client Jars, it displays "Resolution complete" and then again the error messages as above.

    I have all my repositories up-to-date:
    upload_2017-5-5_21-51-35.png

    I tried to compile an APK and it worked, but when I tested, at the moment the scheduled local notification should appears, the app crashed ("XXX has stopped").

    Any idea why it does that?
     
  8. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @NicoL3AS and others experiencing that issue,

    As we've just figured out, Google Play Services Resolver (a Unity library from Google to resolve Android library dependencies) broke with the latest version of Android SDK libs - please see https://github.com/googlesamples/unity-jar-resolver/issues/47 for more details.
    They've already released a patch to solve that, it works but it introduces a different issue instead: https://github.com/googlesamples/unity-jar-resolver/issues/48.

    I'd recommend you to update Google Play Services Resolver anyway as a temporary solution, while we're working on a hotfix to avoid the issue and to not introduce any new one. In order to do it,
    1. Please delete the whole folder Assets/PlayServicesResolver
    2. Download and install the latest version of Google Play Services Resolver: https://github.com/googlesamples/un.../play-services-resolver-1.2.19.0.unitypackage

    It should work, though will produce an annoying error message in the Unity Console, which you'll have to ignore.
    As soon as hotfix is ready, I'll write here, providing a link to a patch, we're also going to submit the hotfix in the Asset Store as soon as it's ready.

    Sorry for that inconvenience and thank you for your patience,

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: May 5, 2017
  9. NicoL3AS

    NicoL3AS

    Joined:
    Oct 7, 2015
    Posts:
    18
    Thanks @Yuriy-Ivanov for your quick and complete reply, as usual :)
    I did what you recommended. Yes there is now an error when launching the Jar Resolver but the local push notifications work anyway. Good luck for the hotfix!
     
  10. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    We've prepared a patched version of the Google Play Services Resolver, which won't post those error messages. Please find it here. For more details on that fix, please see https://github.com/googlesamples/unity-jar-resolver/issues/48.

    We're going to submit a hotfix into Unity Asset Store now.

    Feel free to contact us here or by email in case of any issues.

    UPDATE: version 1.6.3 is already available in the Asset Store.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: May 18, 2017
  11. JGalt

    JGalt

    Joined:
    Nov 19, 2015
    Posts:
    3
    Does anyone know how we can delay the request to allows notifications on iOS? Currently, the pop-up request happens as soon as the app is launched. I would like to delay this until we are actually scheduling a notification.
     
  12. Yuriy-Ivanov

    Yuriy-Ivanov

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

    The notification allowance dialog is shown when you call UTNotifications.Manager.Instance.Initialize. So just initialize UTNotifications.Manager only when you need to schedule a notification instead of the application start, that's it.

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

    leeheisen

    Joined:
    Oct 5, 2016
    Posts:
    5
    Hi Yuriy,

    I've bought your plugin and it works great. I use Crashlytics to gather information of errors and crashes. Recently Crashlytics sends me a lot of crash reports of UTnotification. Could you tell me how this happens and how to solve it?



    Fatal Exception: java.lang.Error: FATAL EXCEPTION [main]
    Unity version : 5.5.2f1
    Device model : samsung SAMSUNG-SM-G870A
    Device fingerprint: samsung/klteattactive/klteattactive:5.0/LRX21T/G870AUCU2BOF3:user/release-keys


    Caused by java.lang.OutOfMemoryError: Failed to allocate a 37748748 byte allocation with 16777216 free bytes and 30MB until OOM
    at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
    at android.graphics.Bitmap.nativeCreateFromParcel(Bitmap.java)
    at android.graphics.Bitmap.access$000(Bitmap.java:37)
    at android.graphics.Bitmap$1.createFromParcel(Bitmap.java:1645)
    at android.graphics.Bitmap$1.createFromParcel(Bitmap.java:1637)
    at android.widget.RemoteViews$BitmapCache.<init>(RemoteViews.java:1034)
    at android.widget.RemoteViews.<init>(RemoteViews.java:2089)
    at android.widget.RemoteViews.<init>(RemoteViews.java:2081)
    at android.app.Notification$BuilderRemoteViews.<init>(Notification.java:5304)
    at android.app.Notification$BuilderRemoteViews.clone(Notification.java:5316)
    at android.app.Notification$BuilderRemoteViews.clone(Notification.java:5302)
    at android.app.Notification.cloneInto(Notification.java:1653)
    at android.app.Notification.clone(Notification.java:1571)
    at android.app.NotificationManager.notify(NotificationManager.java:174)
    at android.app.NotificationManager.notify(NotificationManager.java:136)
    at universal.tools.notifications.Manager.postNotificationPrepared(Manager.java:410)
    at universal.tools.notifications.Manager.postNotification(Manager.java:254)
    at universal.tools.notifications.AlarmBroadcastReceiver.onReceive(AlarmBroadcastReceiver.java:14)
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2948)
    at android.app.ActivityThread.access$1800(ActivityThread.java:172)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1498)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:5835)
    at java.lang.reflect.Method.invoke(Method.java)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
     
  14. Yuriy-Ivanov

    Yuriy-Ivanov

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

    First of all, thanks for using UTNotifications!

    The exception states that the device got out of memory when trying to allocate 36mb image while only 30mb left for your app. It means that you're trying to show a scheduled notification with a huge image or an icon. Just reduce the image/icon size.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: May 27, 2017
  15. wilwilwil

    wilwilwil

    Joined:
    Jul 27, 2012
    Posts:
    19
    Java.io.FileNotFoundException Error
    It is a good asset, but when I create it as a jar file and run it, I get the following error: "Java.io.FileNotFoundException: /certificates.p12" (No such file or directory).
    I'm not good at Java. How can I fix this error? It works fine in Eclipse.
     
  16. Yuriy-Ivanov

    Yuriy-Ivanov

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

    I suppose you're speaking about the DemoServer, aren't you?

    The error states that file "certificates.p12" is not found in the current working directory of the .jar. You probably used a relative path there, and Eclipse sets it to the route folder of the project by default, while starting .jar (with java) will use a different current working directory (it depends on a way you start the .jar app). You may just use the full path to make it work.

    Please also note that the DemoServer is not designed to be used in production - it's just a test tool, helping you to get acquainted with pushing notifications to each of the supported services and to check whether the configuration is valid. It doesn't provide any security (so anyone will be able to send any messages to your clients through it), it's also not designed to handle many (like, thousands and more) client devices.

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

    Yuriy-Ivanov

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

    You can be interested that we've recently released a new asset: UTMail - Email Composition and Sending Plugin.


    UTMail is Unity extension allowing developers composing and sending emails directly from C# code. It provides common cross-platform API and works on multiple platforms:
    • macOS
    • Windows
    • Windows Store (Windows Phone 8.1, Windows 8.1/10, Universal 8.1, Universal 10)
    • Android
    • iOS
    Features:
    • Compose: opens a system email client with a content defined by your app. End-user can then optionally modify the message and send it. The email is sent from the end-user's email address so you can give them a reply.
    • Send: uses SMTP to send emails directly, without showing any windows or popups.
    • SMTP with STARTTLS support on all supported platforms, unlinke standard Unity SmtpClient, which makes it work with most modern secure SMTP servers.
    • Attachments.
    • Multiple To, Cc and Bcc recipients; Subject, Body, HTML Body and attachments are supported for both composing and sending.
    • A sample & test scene, which is completely functional even directly in the Unity Editor.
    Meanwhile, we keep working on the next UTNotifications major update. Stay tuned!

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Jun 18, 2017
    jGate99 likes this.
  18. BBO_Lagoon

    BBO_Lagoon

    Joined:
    Mar 2, 2017
    Posts:
    200
    Hi Yuriy,
    Is there a way to detect if the user has notifications enabled in IOS or Android settings ?
     
  19. Yuriy-Ivanov

    Yuriy-Ivanov

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

    Yes, it is possible:
    Code (CSharp):
    1. UTNotifications.Manager.Instance.NotificationsAllowed()
    In current version it works well on iOS and always returns true on other platforms. Android version is already implemented in our working branch and will be released with a next asset update (as well as API Reference for this method).

    Best regards,
    Yuriy, Universal Tools team.
     
  20. dicastyle

    dicastyle

    Joined:
    Jun 30, 2014
    Posts:
    8
    Hi Yuriy,

    I have a problem. I got the message error of UT Notification. Android 4.4 / Android 5.0
    How can i solve this problem?

    Caused by
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:3132)
    at android.app.ActivityThread.access$1800(ActivityThread.java:181)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1559)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:6145)
    at java.lang.reflect.Method.invoke(Native Method:0)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
    Caused by: java.lang.SecurityException:
    at android.os.Parcel.readException(Parcel.java:1540)
    at android.os.Parcel.readException(Parcel.java:1493)
    at android.app.INotificationManager$Stub$Proxy.cancelAllNotifications(INotificationManager.java:637)
    at android.app.NotificationManager.cancelAll(NotificationManager.java:291)
    at universal.tools.notifications.Manager.hideAllNotifications(Manager.java:384)
    at universal.tools.notifications.Manager.postNotificationPrepared(Manager.java:391)
    at universal.tools.notifications.Manager.postNotification(Manager.java:253)
    at universal.tools.notifications.AlarmBroadcastReceiver.onReceive(AlarmBroadcastReceiver.java:14)

    Thank you for your support.
     
  21. BBO_Lagoon

    BBO_Lagoon

    Joined:
    Mar 2, 2017
    Posts:
    200
    Hi, I'm testing on IOS on an IPad mini,
    I launch my app,
    I click no when it asks me for notifications but UTNotifications.Manager.Instance.NotificationsAllowed() returns true.

    In settings the notifications for my app are disabled.
    I call UTNotifications.Manager.Instance.NotificationsAllowed() on the OnSendRegistrationId callback.
    I have UTNotification v1.6.3

    Maybe I'm doing something wrong ?
     
  22. KingIsBack

    KingIsBack

    Joined:
    Apr 15, 2013
    Posts:
    3
    Hello @Yuriy-Ivanov ,

    I have bought UTNotification plugin. It works perfectly fine on android except icons are not shown which i am setting in default profile in Editor settings. Instead it takes Apps icons & showing white on Android 5.0+. I have transparent white icons specially made for notifications which i am setting in profiles with respective sizes. What could be the reason for this behavior?

    But if i replace all the app icons with transparent icons, it shows correctly in notification drawer but then Apps icon became transparent too.

    I am using gradle for making build. & i can see there is no icon copied in drawable folder from UTNotification setting when extracted apk.
     
    Last edited: Jun 21, 2017
  23. Dougomite

    Dougomite

    Joined:
    Jul 15, 2011
    Posts:
    58
    I'm having the same issue. I'm using Unity 4.7 and UTNotifications 1.6.3. As far as I can tell the profiles are setup correctly but when I try to use the profiles I don't get the custom sound or icon. I noticed that the UTNotificationSettings saves the entire absolute location of the sounds and icons. This could be a problem because our builds are done on a separate build machine so the file path would different.
     
  24. Yuriy-Ivanov

    Yuriy-Ivanov

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

    It's a new issue for us, but it seems that some people have faced the same while working with NotificationManager too (built-in Android class): f.e. see https://stackoverflow.com/questions...managercompatcancelall-gets-securityexception & https://stackoverflow.com/questions...rmission-denial-getintentsender-from-pid-1484.
    Unfortunately there doesn't seem to be any known solution. I took a brief look into Android source code, and there is still no clear reason of it - the exception happened somewhere in an internal operating system service and was then dispatched to android.app.NotificationManager. It may be a bug in a specific build of Android or Android Support Library, which implements notifications API on Android (among other functionality). By the way, the line numbers shown in your stack trace don't match the sources of any version of Android I checked (I looked into several releases of Android 4.4, Android 5.0 and even Android 5.1, though you didn't even mention 5.1). So it can be some custom Android build from a specific vendor or a modification like CyanogenMod (though it may just be a different official version of Android). Can you please check what exact version of Android is installed on the device causing the issue?
    Do you know, in general, how to reproduce that issue? Does it happen with a specific device / vendor? How often? Which version of Android Support Library was used in the build (you can find it in your Assets/Plugins/Android/support-v4-*.aar). I'll probably have to report the bug to Google or to a device vendor.

    Right now, I can offer you disabling "Show Only Latest Notification" option in UTNotifications settings - then it will not call android.app.NotificationManager.cancelAll when showing a notification. Alternatively, you can wrap the cancelAll call in universal.tools.notifications.Manager.hideAllNotifications with try/catch to ignore any exception in it. Not really a solution, I know, but will make it work at least (probably in some rare cases "Show Only Latest Notification" will just not work then).

    Looking forward to hearing any details from you.

    Best regards,
    Yuriy, Universal Tools team.
     
    dicastyle likes this.
  25. Yuriy-Ivanov

    Yuriy-Ivanov

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

    That's strange for 2 reasons:
    1. It works well for me.
    2. OnSendRegistrationId can only be called, when notifications are indeed allowed for your app!

    Can you please create a sample Unity project reproducing that issue and send it us to universal.tools.contact@gmail.com? As currently we just can't reproduce the issue.

    Thank you and best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Jun 21, 2017
  26. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    @KingIsBack , @Dougomite ,

    Can you please check 2 things:
    1. Whether folder Assets/Plugins/Android/UTNotificationsRes exists in your project after you configured the default profile.
    2. Whether folder Assets/UTNotifications/Editor/Android/Res exists and contains these two files: AndroidManifest.xml & project.properties?

    As one of our clients already reported an issue with an absent Assets/UTNotifications/Editor/Android/Res folder, which is actually a part of UTNotifications package, which is downloaded from the Unity Asset Store.

    @KingIsBack , please also tell me the version of Unity you're working on. I know that @Dougomite is on 4.7.

    Looking forward to hearing from both of you to resolve it asap.

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

    Dougomite

    Joined:
    Jul 15, 2011
    Posts:
    58
    Ah, it looks like I'm missing whatever would be in "Assets/UTNotifications/Editor/Android/Res". The folder is there but it is empty for me. I'll try re-importing the files that should be there and trying a build.
     
  28. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    As I thought. To tell the truth, I've no idea why the 2 files are missing, they should be in the asset package. But here I've attached an archive with both of them. Please add them into Assets/UTNotifications/Editor/Android/Res, then reset the default profile settings, save it, and then configure it again. It should help. Please inform me about the results.
     

    Attached Files:

  29. Dougomite

    Dougomite

    Joined:
    Jul 15, 2011
    Posts:
    58
    This fixed my problem, the icons are correctly showing up now.

    In our case, we had moved the UTNotifications folder into a subfolder like "Assets/GameScripts/UTNotifications" so the folder and files were there in "Assets/GameScripts/UTNotifications/Editor/Android/Res". So simply moving the necessary files back to "Assets/UTNotifications/Editor/Android/Res" seems to have fixed it.

    There was also copy of "Assets/GameScripts/UTNotifications/Resources/UTNotificationSettings" which I had removed earlier but wasn't sure why it was there. I'm thinking that the Edit->Project Settings->UTNotification menu item created a new "Assets/UTNotifications/Resources/UTNotificationSettings" and I'm not sure if that had anything to do with all this.
     
    Last edited: Jun 21, 2017
  30. dicastyle

    dicastyle

    Joined:
    Jun 30, 2014
    Posts:
    8
    I checked the android version (in my game)

    Problem Android version :
    Android 7.0 / Android 5.0.2 / Android 4.4.2
     
  31. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Thank you. What about the rest? Which version of Android was on the device the stack trace was taken on? How often does it happen? What are the steps to reproduce? Which are the device vendors, different or the same? What version of Android Support Library is your project built with?
     
    Last edited: Jun 22, 2017
  32. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Oh, it all starts to make sense now! Sure, unfortunately UTNotifications will not work well if moved to a different location. I'm afraid you'll have to tolerate the original location.

    Best regards,
    Yuriy, Universal Tools team.
     
  33. dicastyle

    dicastyle

    Joined:
    Jun 30, 2014
    Posts:
    8
    Thank you. What about the rest?
    The others's stack traces is similar.

    Which version of Android was on the device the stack trace was taken on?
    below stack trace -> android version 5.0.2
    java.lang.Error: FATAL EXCEPTION [main] Unity version : 5.5.4f1 Device model : samsung SM-T710 Device fingerprint: samsung/gts28wifixx/gts28wifi:5.0.2/LRX22G/T710XXU2AOJ4:user/release-keys Caused by
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:3132)
    at android.app.ActivityThread.access$1800(ActivityThread.java:181)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1559)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:6145)
    at java.lang.reflect.Method.invoke(Native Method:0)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
    Caused by: java.lang.SecurityException:
    at android.os.Parcel.readException(Parcel.java:1540)
    at android.os.Parcel.readException(Parcel.java:1493)
    at android.app.INotificationManager$Stub$Proxy.cancelAllNotifications(INotificationManager.java:637)
    at android.app.NotificationManager.cancelAll(NotificationManager.java:291)
    at universal.tools.notifications.Manager.hideAllNotifications(Manager.java:384)
    at universal.tools.notifications.Manager.postNotificationPrepared(Manager.java:391)
    at universal.tools.notifications.Manager.postNotification(Manager.java:253)
    at universal.tools.notifications.AlarmBroadcastReceiver.onReceive(AlarmBroadcastReceiver.java:14)
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:3125)

    How often does it happen?
    I think about 1/8000-10000 DAU.

    What are the steps to reproduce?
    - I don't know, it was found by user's device. I cannot find it via my devices.

    Which are the device vendors, different or the same?
    - SAMSUNG Galaxy Tab S2 8.0(gts28wifi) : Android 5.0
    - HTC HTC Desire 626G+ dual sim(htc_a32mg_dug) : Android 4.4
    - SHARP AQUOS U SHV35(SHV35) / AQUOS Xx3 mini(SG603SH) : Android 7.0


    What version of Android Support Library is your project built with?
    support-v4-24.0.0.aar
     
  34. Yuriy-Ivanov

    Yuriy-Ivanov

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

    Thank you for all the details. I found a very similar (though not exactly the same) bug reported to Google: https://issuetracker.google.com/u/1/issues/36977976. If the bug has the same cause, then it was reported back in 2014 but wasn't really fixed. I commented the bug with the details you submitted, we'll see what Google thinks about it.

    Meanwhile, I created and sent you to private messages a patch, which makes UTNotifications Android native plugin ignore any exceptions in android.app.NotificationManager.cancelAll and android.app.NotificationManager.cancel (they are just logged). It should be OK, especially considering the rareness of the exception (in these rare cases there may be just more than one notification from your app be shown, which is definitely better than a crash).

    As soon as Google replies anything, I'll let you know.

    Best regards,
    Yuriy, Universal Tools team.
     
  35. stevencoull

    stevencoull

    Joined:
    Sep 15, 2016
    Posts:
    16
    Hey Yuriy,

    Thanks for all your help up until this point, we've found UTNotifications to be a great asset to our app!

    Recently we reached the 65K method limit and I've been trying to cut out unnecessary plugins/dlls. I noticed that in UTNotificationsDependencies.cs you are adding a dependency on all of the "support" dlls. By removing this class and adding only the dlls I think I need I was able to get under the limit, but are you just to confirm, these are the dlls I removed:
    support-compat, support-core-ui, support-core-utils, support-fragment, support-media-compat​
    Leaving me with:
    support-annotations and support-v4​
    Does this sound okay? Are you using any of the deleted libraries somewhere that I may have missed during my testing?
     
    jGate99 likes this.
  36. Yuriy-Ivanov

    Yuriy-Ivanov

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

    The main thing we're using from Android Support Library is NotificationCompat.Builder, which belongs to package android.support.v4.app. I'm not sure which exact libraries are required to link to to avail that package. Official Android docs just mention the whole Android Support Library v4, which we resolve using Google Play Services Resolver. All the libs you mentioned are imported by the resolver as the support library dependencies. I can't guarantee everything will work well without those libs. You may just test all the features of UTNotifications you're using, if nothing is broken so be it.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Jul 5, 2017
  37. rick0

    rick0

    Joined:
    Sep 14, 2016
    Posts:
    2
    Hi guys,

    I've been using UTNotifications for a bit now and it's great. Was just wondering if it is possible to set an end date for recurring local notifications? I looked in the documentation and on google but didn't find anything.
    We are currently handling this in the game when it opens but obviously if it is not opened it will not stop creating notifications!

    Thanks
     
  38. Yuriy-Ivanov

    Yuriy-Ivanov

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

    It's a good questions really. Technically, there is nothing difficult to implement the end date on Android & Windows Store (as showing notification is done by UTNotifications native plugins source code, and you could add a check whether the notification has expired), though I'm afraid I don't know a way to do it on iOS.

    How many times the scheduled notification should fire before expiring? If not so many (like about a dozen), than you could just schedule an appropriate number of non-repeating notifications in advance (with the same content but different ids). In the other case, you may have to rely on the fact, that your app will be started some time about the expiration date.

    Please let me know if Android/Windows Store only solution may be helpful for you and if you need any details on what to change in the native plugins to achieve that.

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

    rick0

    Joined:
    Sep 14, 2016
    Posts:
    2
    Hi Yuriy,

    Thanks for your reply, it was very helpful.

    We've decided to go with your idea of scheduling individual notifications rather than use the recurring functionality, that way a user won't get endless notifications if they never open the app again.

    Thanks again!
     
  40. VincentValet

    VincentValet

    Joined:
    Aug 14, 2015
    Posts:
    2
    Hi!

    I used your plugin, it is really great!

    But I have an issue and I don't know how to resolve it.
    When I call the Initialize function, it works great (return true) on certain devices, but others it return false. I don't know why.
    It seems it's not working with Android version 7.0 and above. It works on my android device 6.0.1. (Galaxy S5)

    EDIT1: It works on one of my S7 Edge, but not another one. (android 7.0)

    I have Unity 5.6.0p2 and all packages from AndroidSDK installed from API16 to the last one.

    Thank you!
     
    Last edited: Jul 21, 2017
  41. VincentValet

    VincentValet

    Joined:
    Aug 14, 2015
    Posts:
    2
    Hi again.

    There is a way to debug why the Initialize function return false sometimes please?

    Thanks!
     
  42. Yuriy-Ivanov

    Yuriy-Ivanov

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

    Sorry I haven't replied here, Unity didn't inform me about your posts in a forum. Thanks for contacting us by email, we're currently looking into your issue, thanks to the additional details you provided.

    Best regards,
    Yuriy, Universal Tools team.
     
  43. Eljo_huckleberry

    Eljo_huckleberry

    Joined:
    Jun 1, 2017
    Posts:
    10
    @Yuriy-Ivanov Having bought UTNotifications today and using it to easily set up some project requirements, I cannot seem to get rid of both "external storage" and "read phone state" permissions that only appear in my AndroidManifest when I include UINotifications.

    I went back to various git commits and none of my previous ones trigger this behavior, but as soon as this component is added, it shows up. The only other thing to note is that I had to remove the "Support annotations" file from the Unity Facebook SDK in order to prevent compile errors.

    Having wasted a couple of hours on the issue, I was wondering if you have any idea to help me out. Removing the demo files also didn't do anything. I'm using Unity 2017.1.0f3

    Thanks in advance!
    Eljo
     
  44. Yuriy-Ivanov

    Yuriy-Ivanov

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

    First of all, thank you for using UTNotifications.

    I've just checked with Unity 2017.1.0f3, UTNotifications 1.6.3:
    Code (CSharp):
    1.   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
    2.   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
    Is added by Unity even in an absolutely empty project, no UTNotifications is imported (some project settings may affect that, I'm not sure). But it's a very basic permission, used by virtually any Android app or game.

    READ_PHONE_STATE permission is not requested even when UTNotifications is imported, configured and used, we don't need nor use that permission. Please make sure you haven't used SystemInfo.deviceUniqueIdentifier in your code anywhere as Unity, indeed, requests the READ_PHONE_STATE permission when meeting it in the code (it's implemented in Unity by getting some phone related ids, such as IMEI). Please note, that UTNotifications sample scene uses SystemInfo.deviceUniqueIdentifier, but not on Android: it's done on purpose to avoid requesting that permission.

    Hopefully it helps.

    Best regards,
    Yuriy, Universal Tools team.
     
  45. Eljo_huckleberry

    Eljo_huckleberry

    Joined:
    Jun 1, 2017
    Posts:
    10
    Hey!

    Thanks for your quick reply, much appreciated. I ran some tests and my findings are as follows, building from a clean project:

    Unity only automatically adds both EXTERNAL_STORAGE permissions when the "Development Build" box is enabled.
    Otherwise, the only one added is INTERNET, which is perfectly fine.
    Importing UTNotifications 1.6.3 on a clean project did require me to add xmlns:tools="http://schemas.android.com/tools" to the manifest, but apart from that the resulting APK was looking fine.

    In my project though, it seems something is triggering the storage and phone_state permission additions and having spent another few hours on it, I have absolutely no idea where these are coming from. As I have to move forward at the moment, I decided to go by adding the permission to my manifest with the tools:node="remove" option in order to force them out. It works for now, but I wish this process was a lot simpler as it doesn't grab the bull by the horns.

    Greetings!
     
  46. Yuriy-Ivanov

    Yuriy-Ivanov

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

    We got informed that the issue you're facing (with READ_PHONE_STATE) is a known Unity issue with Android SDK 26: https://forum.unity3d.com/threads/s...-merge-android-manifests.490096/#post-3198806. This is the fix: https://forum.unity3d.com/threads/r...ion-added-when-using-sdk-tools-26-0-2.481478/

    Hopefully it helps

    Best regards,
    Yuriy, Universal Tools team.
     
  47. Simon75012

    Simon75012

    Joined:
    Sep 15, 2016
    Posts:
    79
    Hi,
    How do i request notification permission for ios?
     
  48. quako

    quako

    Joined:
    Jan 19, 2012
    Posts:
    6
    OnAppPause(bool pause)
    {
    if(pause)
    {
    //schedule 50 notifications
    }
    else
    {
    // cancel all notifications
    }

    }

    after pausing the app several times, the logcat is complaining of too many alarms, is cancelNotifications working properly?
     
  49. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    UTNotifications will do it for you automatically when required, on calling UTNotifications.Manager.Instance.Initialize.

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

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    There was, indeed, an issue with alarms some time ago (then notifications were cleared while their alarms could remain). It shouldn't happen with UTNotifications 1.6.3 (although there is a known bug on some Samsung devices: their customized builds of Android could prevent any alarms to be removed). If the issue is reproduced for you with UTNotifications 1.6.3., please tell me the device model you're testing on and its exact version of Android, I'll try to figure out what's going on.

    Best regards,
    Yuriy, Universal Tools team.