Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Mobile Notification Package

Discussion in 'Android' started by _Paulius, Jan 28, 2019.

  1. Thanitsak

    Thanitsak

    Joined:
    Jan 4, 2016
    Posts:
    116
    @_Paulius Thank you for the Preview.5, but I still can't build to Android with this error message can you please help me?
    " uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:androidnotifications-release:] /Users/boat/.gradle/caches/transforms-2/files-2.1/fb7c79ba145e7743e9336783342f5507/AndroidManifest.xml as the library might be using APIs not available in 16

    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)"
    I install and use everything from Unity and I noticed that in 2019.2 there is a new option when choose on Android platform that said OpenJDK which I also choose to install with. Thank you in advance!
     
    Qbit86 likes this.
  2. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @BoatBest The minimum Android version supported by the package is now Android 4.4 (API 19) so you need to change the Minimum API level settings for your project:

    upload_2019-8-7_14-13-45.png
     
    Thanitsak likes this.
  3. Thanitsak

    Thanitsak

    Joined:
    Jan 4, 2016
    Posts:
    116
    Oh It is working now!! Thank you very very much @_Paulius !! Am I understanding correctly that in Android we can't modify app badge number like iOS at the moment? Also I don't know whether you know about this or not, but would you mind checking this out because I have asked multiple times about this in the forum but no one answering any of them https://forum.unity.com/threads/api-update-required-pop-up-every-time-i-open-unity-editor.723656/
     
  4. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    429
    Yes now it is visible, thanks.
    I will keep in mind that it take some time for package to become visible in package window after release.
     
  5. chriscode

    chriscode

    Joined:
    Mar 2, 2015
    Posts:
    48
    I'm testing this on my Honor Play phone, and notifications ONLY work if the app is open.
    BUT: I have the mobile game Lifeline - which I DO get notifications from, and does work offline....

    Any ideas?
     
  6. chriscode

    chriscode

    Joined:
    Mar 2, 2015
    Posts:
    48
    Edit:
    If I go: Settings/Battery/App Launch/
    And turn off: Manage Automatically

    And leave Run in background turned ON

    It works even when closed.

    But that's still odd as other apps do notify me on the standard setttings....


     
    Bastienre4 likes this.
  7. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    163
    I had staging in my manifest. When I removed it, I was able to download the latest version.
     
  8. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    163
    Are you sure the notifications are created properly?
    In my game I couldn't create them when the game closed or lost focus, because sometimes the game got killed while it was still creating notifications. Therefore I had to create them before closing.
     
  9. chriscode

    chriscode

    Joined:
    Mar 2, 2015
    Posts:
    48
    Yeah I think so: creating them straight away
    They work with app open
    They also work on my ancient tablet.
     
  10. MetaDOS

    MetaDOS

    Joined:
    Nov 10, 2013
    Posts:
    156
    Hi. Does this plugin support the custom layout push notifications like this on Android?
    Screenshot_20190812-155539.png
     
    qorcjftmd0228 and Livealot like this.
  11. Bastienre4

    Bastienre4

    Joined:
    Jul 8, 2014
    Posts:
    191
    Unfortunatly it's not related. I added a debug button to allow me to test the notification (the button simply schedule a notification 1 minute later) but if I close the app the notification never occur.

    I'm in the same situation with an Honor 10.
     
  12. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    1.0.3-preview.6 was just published, fixes and improvements:

    Fixes:
    • [iOS] It's no longer necessary to enable the Request Authorization on App Start setting in UI to be able to turn on Enable Push Notifications.
    • [iOS] GetLastRespondedNotification should now properly return the notification used to open the app even if "Request Authorization on App Start" is turned off.
    • [iOS] iOSNotification.data field should now work properly with all valid JSON structures and not only with dictionaries and strings.
    • [Android] OnNotificationReceivedis now executed on the main Unity thread so it should now be possible to directly call Unity API methods the only work on the main thread from delegates and functions that subscribe to the this method.
     
  13. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    From what I understand Xiaomi & Huawei might be whitelisting certain apps dowloaded from the store which allows them to ignore the power saver without the user explicitly turning on the "Run in Background" setting for them.

    @LeGiangAnh not yet, but's it in our backlog.
     
    MetaDOS and Bastienre4 like this.
  14. mangoes1

    mangoes1

    Joined:
    Nov 29, 2018
    Posts:
    1
    Is there a recommended solution to handle method swizzling and other 3rd party notification services?

    I'm using Firebase messaging which tries to do method swizzling. They have solutions if you disable the Firebase method swizzling, but if I go down that road, from what I can tell that would involve me modifying the code of this package (in particular, UnityNotificationManager.m) to call Firebase methods (https://firebase.google.com/docs/cloud-messaging/ios/receive#handle-swizzle). Is that my best bet, or is there a nicer solution that already exists for this issue?
     
  15. Cabello9

    Cabello9

    Joined:
    Apr 7, 2018
    Posts:
    3
    Hi, I'm selecting "Reschedule Notifications on Device Restart" option but my notifications aren't showing after restart my phone. I check that my AndroidManifest is not updated with "RECEIVE_BOOT_COMPLETED" permission. I tried to add it manually with this:
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> but this doesnt work too.

    What is wrong? I'm using 1.0.3 preview 6 version.

    Thank you!
     
  16. Nieles_GH

    Nieles_GH

    Joined:
    Jun 26, 2017
    Posts:
    57
    @_Paulius The first time I start the game on iOS and register the device token with our backend I can send push notifications. But when I restart the game and try to send another push notification the backend returns the following error:

    Error: iOS Push Notification Failed: InvalidParameter Invalid parameter: TargetArn Reason: No endpoint found for the target arn specified.

    Since I can keep sending push notifications until I restart the app I'm thinking it must be something wrong from the game side and not the backend. I turned on Register for Push Notifications on App Launch.
     
  17. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @Cabello9 Do you have custom manifest or otherwise modify the manifest before building the APK?

    For rescheduling to work you need:
    Code (JavaScript):
    1. <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    and
    Code (CSharp):
    1. <application ..>
    2. <meta-data android:name="reschedule_notifications_on_restart" android:value="true" />
    3. </application>
    in AndroidManifest.xml.

    @Nieles_GH I can't reproduce this using https://github.com/noodlewerk/NWPusher. Did the token returned by the app actually change after it was reopened? For me the token only resets if I delete the app and install it again just restarting it shouldn't change the token.
     
  18. Nieles_GH

    Nieles_GH

    Joined:
    Jun 26, 2017
    Posts:
    57
    Sorry, it appeared to be related to Firebase. I think maybe they were both registering to push notifications. Disabling Firebase on iOS fixed the issue.
     
  19. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    I had everything working great a couple of previews ago, but the latest, preview 6 is not working. It seems like GameNotificationChannel does not like when VibrationPattern = null, which is the default. The error that pops in AndroidLogCat is that the value can't be null. There's earlier posts about this that don't seem to be answered.

    upload_2019-8-20_9-35-9.png
     
    Last edited: Aug 20, 2019
    unity_REX_a-O31xgnYQ likes this.
  20. alankarmisra

    alankarmisra

    Joined:
    Oct 12, 2017
    Posts:
    7
    macOS Mojave, 10.14.6, Unity 2019.2.1f1, Mobile Notifications preview .6 - 1.0.3, trying to compile for iOS and I get:
    IL2CPP error for type 'Notifications.GameNotificationChannel' in assembly '/projectDirectory/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll'
    Additional information: SafeArray element type Int64 is not supported.

    Failed running /Applications/Unity/Hub/Editor/2019.2.1f1/Unity.app/Contents/il2cpp/build/il2cppcore/il2cppcore.dll --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --profiler-report --map-file-parser="/Applications/Unity/Hub/Editor/2019.2.1f1/Unity.app/Contents/Tools/MapFileParser/MapFileParser" --directory="/projectDirectory/Temp/StagingArea/Data/Managed" --generatedcppdir="/projectDirectory/Temp/il2cppOutput/il2cppOutput"

    stdout:
    IL2CPP error for type 'Notifications.GameNotificationChannel' in assembly '/projectDirectory/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll'
    Additional information: SafeArray element type Int64 is not supported.
    il2cpp.exe didn't catch exception: System.NotSupportedException: SafeArray element type Int64 is not supported.
    at Unity.IL2CPP.Marshaling.MarshalInfoWriters.ComSafeArrayMarshalInfoWriter.GetElementVariantType(MetadataType metadataType)
    at Unity.IL2CPP.Marshaling.MarshalInfoWriters.ComSafeArrayMarshalInfoWriter..ctor(ArrayType type)
    at Unity.IL2CPP.Marshaling.MarshalDataCollector.CreateMarshalInfoWriter(TypeReference type, MarshalType marshalType, MarshalInfo marshalInfo, Boolean useUnicodeCharSet, Boolean forByReferenceType, Boolean forFieldMarshaling, Boolean forReturnValue, Boolean forNativeToManagedWrapper, HashSet`1 typesForRecursiveFields)
    at Unity.IL2CPP.Marshaling.MarshalDataCollector.<>c__DisplayClass1_0.<CreateMarshalInfoWriter>b__1(FieldDefinition field)
    at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
    at Unity.IL2CPP.Marshaling.MarshalDataCollector.CreateMarshalInfoWriter(TypeReference type, MarshalType marshalType, MarshalInfo marshalInfo, Boolean useUnicodeCharSet, Boolean forByReferenceType, Boolean forFieldMarshaling, Boolean forReturnValue, Boolean forNativeToManagedWrapper, HashSet`1 typesForRecursiveFields)
    at Unity.IL2CPP.SourceWriter.WriteMarshalingDefinitions(IGeneratedMethodCodeWriter writer, TypeReference type, IInteropDataCollector interopDataCollector)
    at Unity.IL2CPP.SourceWriter.<>c__DisplayClass7_0.<WriteMethodSourceFiles>b__0(IGeneratedMethodCodeWriter writer, TypeReference type)
    at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable`1 items, String fileName, Int64 chunkSize, Action`1 writeHeaderAction, Action`2 writeItemAction, Action`1 writeFooterAction, SourceWritingContext sourceWritingContext, Action`2 writeEnd)
    at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable`1 items, String fileName, Int64 chunkSize, Action`2 writeItemAction, SourceWritingContext sourceWritingContext, Action`2 writeEnd)
    at Unity.IL2CPP.SourceWriter.WriteMethodSourceFiles(NPath outputDirectory, SourceWritingContext sourceWritingContext, String fileName, IEnumerable`1 typeList, IMethodCollector methodCollector, Boolean writeMarshalingDefinitions)
    at Unity.IL2CPP.SourceWriter.Write(NPath outputDir, SourceWritingContext sourceWritingContext, AssemblyDefinition assemblyDefinition, IMethodCollector methodCollector)
    at Unity.IL2CPP.AssemblyConverter.Apply()
    at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable`1 assemblyDirectories, IEnumerable`1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[] searchDirectories, String entryAssemblyName, NPath[] extraTypesFiles)
    at il2cpp.Program.DoRun(String[] args)
    at il2cpp.Program.Run(String[] args)
    at il2cpp.Program.Main(String[] args)
    stderr:

    Unhandled Exception: System.NotSupportedException: SafeArray element type Int64 is not supported.
    at Unity.IL2CPP.Marshaling.MarshalInfoWriters.ComSafeArrayMarshalInfoWriter.GetElementVariantType(MetadataType metadataType)
    at Unity.IL2CPP.Marshaling.MarshalInfoWriters.ComSafeArrayMarshalInfoWriter..ctor(ArrayType type)
    at Unity.IL2CPP.Marshaling.MarshalDataCollector.CreateMarshalInfoWriter(TypeReference type, MarshalType marshalType, MarshalInfo marshalInfo, Boolean useUnicodeCharSet, Boolean forByReferenceType, Boolean forFieldMarshaling, Boolean forReturnValue, Boolean forNativeToManagedWrapper, HashSet`1 typesForRecursiveFields)
    at Unity.IL2CPP.Marshaling.MarshalDataCollector.<>c__DisplayClass1_0.<CreateMarshalInfoWriter>b__1(FieldDefinition field)
    at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
    at Unity.IL2CPP.Marshaling.MarshalDataCollector.CreateMarshalInfoWriter(TypeReference type, MarshalType marshalType, MarshalInfo marshalInfo, Boolean useUnicodeCharSet, Boolean forByReferenceType, Boolean forFieldMarshaling, Boolean forReturnValue, Boolean forNativeToManagedWrapper, HashSet`1 typesForRecursiveFields)
    at Unity.IL2CPP.SourceWriter.WriteMarshalingDefinitions(IGeneratedMethodCodeWriter writer, TypeReference type, IInteropDataCollector interopDataCollector)
    at Unity.IL2CPP.SourceWriter.<>c__DisplayClass7_0.<WriteMethodSourceFiles>b__0(IGeneratedMethodCodeWriter writer, TypeReference type)
    at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable`1 items, String fileName, Int64 chunkSize, Action`1 writeHeaderAction, Action`2 writeItemAction, Action`1 writeFooterAction, SourceWritingContext sourceWritingContext, Action`2 writeEnd)
    at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable`1 items, String fileName, Int64 chunkSize, Action`2 writeItemAction, SourceWritingContext sourceWritingContext, Action`2 writeEnd)
    at Unity.IL2CPP.SourceWriter.WriteMethodSourceFiles(NPath outputDirectory, SourceWritingContext sourceWritingContext, String fileName, IEnumerable`1 typeList, IMethodCollector methodCollector, Boolean writeMarshalingDefinitions)
    at Unity.IL2CPP.SourceWriter.Write(NPath outputDir, SourceWritingContext sourceWritingContext, AssemblyDefinition assemblyDefinition, IMethodCollector methodCollector)
    at Unity.IL2CPP.AssemblyConverter.Apply()
    at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable`1 assemblyDirectories, IEnumerable`1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[] searchDirectories, String entryAssemblyName, NPath[] extraTypesFiles)
    at il2cpp.Program.DoRun(String[] args)
    at il2cpp.Program.Run(String[] args)
    at il2cpp.Program.Main(String[] args)
    at Program.Main(String[] args) in /Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/il2cppcore/Program.cs:line 24

    UnityEngine.Debug:LogError(Object)
    UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:126)
    UnityEditorInternal.Runner:RunNetCoreProgram(String, String, String, CompilerOutputParserBase, Action`1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:77)
    UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:500)
    UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:483)
    UnityEditorInternal.IL2CPPBuilder:Run() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
    UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
    MileSplit likes this.
  21. rlewicki

    rlewicki

    Joined:
    Aug 28, 2018
    Posts:
    4
    Hi, in documentation for iOS you say that if you don't specify identifier for notification you will generate random unique one. When I omit intentionally the identifier variable I get crash on iOS devices with following error:
    Uncaught exception: NSInvalidArgumentException: *** +[NSString stringWithUTF8String:]: NULL cString


    This is the callstack:
    Code (CSharp):
    1. 0x0000000186bc7d50 <redacted> + 148
    2. 0x00000001860dc528 objc_exception_throw + 56
    3. 0x0000000186bc7c80 <redacted> + 0
    4. 0x00000001874acb5c <redacted> + 92
    5. 0x00000001007af160 _ScheduleLocalNotification + 2364
    6. 0x00000001025fcedc iOSNotificationsWrapper__ScheduleLocalNotification_m4F901D298DEB899D3E28229AF7B4401660F476D3 + 28
    If I specify the identifier, notification is scheduled properly. Could you please update your documentation or fix the issue please? :)

    We are talking about version 1.0.3-preview.6 by the way.
     
    Last edited: Aug 20, 2019
  22. JorisEertink

    JorisEertink

    Joined:
    Mar 15, 2017
    Posts:
    24
    Hi @_Paulius ,

    We are using the Notification package v1.0.3-preview, and whilst making local builds works perfectly fine, we are not able to get the cloud builds to work when this package is in the project.

    We tried multiple versions of the package, all have this issue.
    If our code does not reference this package, but is still in the project, the build succeeds.

    Attached is the logs of the cloud build:
    4607: [Unity] Receiving unhandled NULL exception
    4608: [Unity] Obtained 35 stack frames.
    4609: [Unity] #0 0x0000010c8932e1 in SortByExecutionOrder(SavedObject const&, SavedObject const&)
    4610: [Unity] #1 0x0000010c8a32ad in void std::__1::__stable_sort<bool (*&)(SavedObject const&, SavedObject const&), SavedObject*>(SavedObject*, SavedObject*, bool (*&)(SavedObject const&, SavedObject const&), std::__1::iterator_traits<SavedObject*>::difference_type, std::__1::iterator_traits<SavedObject*>::value_type*, long)
    4611: [Unity] #2 0x0000010c892c51 in MonoManager::EndReloadAssembly(DomainReloadingData&, dynamic_bitset)
    4612: [Unity] #3 0x0000010c891798 in MonoManager::ReloadAssembly()
    4613: [Unity] #4 0x0000010a5645de in ReloadAllUsedAssemblies()
    4614: [Unity] #5 0x0000010a571c13 in HandleCompileStatus(CompileStatus, ScriptCompileFlags, bool)
    4615: [Unity] #6 0x0000010a571afa in CompileScriptsWait(ScriptCompileFlags, EditorScriptCompilationOptions, BuildTargetPlatformGroup, BuildTargetPlatform, bool)
    4616: [Unity] #7 0x0000010a565e78 in CompileDirtyScriptsForEditorSync(core::basic_string<char, core::StringStorageDefault<char> > const&, ScriptCompileFlags, BuildTargetPlatformGroup, BuildTargetPlatform, bool)
    4617: [Unity] #8 0x0000010a5660e1 in CompileScriptsForEditorSync(ScriptCompileFlags, bool)
    4618: [Unity] #9 0x0000010a568b01 in LoadMonoAssembliesAndRecompileIfNecessary(bool)
    4619: [Unity] #10 0x0000010ac3170e in Application::InitializeProject()
    4620: [Unity] #11 0x0000010d976efc in -[EditorApplication applicationDidFinishLaunching:]
    4621: [Unity] #12 0x007fff2b6f38ac in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
    4622: [Unity] #13 0x007fff2b6f377a in _CFXRegistrationPost
    4623: [Unity] #14 0x007fff2b6f34b1 in ___CFXNotificationPost_block_invoke
    4624: [Unity] #15 0x007fff2b6b2042 in -[_CFXNotificationRegistrar find:object:observer:enumerator:]
    4625: [Unity] #16 0x007fff2b6b10d3 in _CFXNotificationPost
    4626: [Unity] #17 0x007fff2d7db817 in -[NSNotificationCenter postNotificationName:object:userInfo:]
    4627: [Unity] #18 0x007fff28da0206 in -[NSApplication _postDidFinishNotification]
    4628: [Unity] #19 0x007fff28d9fe4f in -[NSApplication _sendFinishLaunchingNotification]
    4629: [Unity] #20 0x007fff28c72ab3 in -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:]
    4630: [Unity] #21 0x007fff28c726e9 in -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:]
    4631: [Unity] #22 0x007fff2d81e664 in -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:]
    4632: [Unity] #23 0x007fff2d81e4e2 in _NSAppleEventManagerGenericHandler
    4633: [Unity] #24 0x007fff2c7f6f08 in aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*)
    4634: [Unity] #25 0x007fff2c7f67af in dispatchEventAndSendReply(AEDesc const*, AEDesc*)
    4635: [Unity] #26 0x007fff2c7f669d in aeProcessAppleEvent
    4636: [Unity] #27 0x007fff2a9cd4a0 in AEProcessAppleEvent
    4637: [Unity] #28 0x007fff28c6dd32 in _DPSNextEvent
    4638: [Unity] #29 0x007fff29403e34 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
    4639: [Unity] #30 0x007fff28c62885 in -[NSApplication run]
    4640: [Unity] #31 0x007fff28c31a72 in NSApplicationMain
    4641: [Unity] #32 0x0000010d9b663c in EditorMain(int, char const**)
    4642: [Unity] #33 0x0000010d9b6909 in main
    4643: [Unity] #34 0x007fff536ac015 in start
    4644: ! Unity player export failed!
    4645: [Unity Package Manager (Upm)]
    4646: Parent process [4308] was terminated


    Hope you can help us out to get the cloud builds back up and running! :)

    Cheers,

    Joris
     
  23. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
  24. nikasamoilik

    nikasamoilik

    Joined:
    Oct 16, 2018
    Posts:
    1
    _paulius I Have the same problem that @alankarmisra... I even cant get package... Unity get errors when try to compile the project. All the same errors. And this is my real project. I update them from 2018.3 to 2019.2.2f1 (x64).
    And i cant test it even in editor, get errors.
    First i get:

    ArgumentNullException: Value cannot be null.
    Parameter name: source
    System.Linq.Enumerable.Select[TSource,TResult] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] selector) (at <fbb5ed17eb6e46c680000f8910ebb50c>:0)
    Unity.Notifications.Android.AndroidNotificationChannel.set_VibrationPattern (System.Int64[] value) (at Library/PackageCache/com.unity.mobile.notifications@1.0.3/Runtime/Android/AndroidNotificationCenter.cs:545)
    NotificationSamples.GameNotificationsManager.Initialize (NotificationSamples.GameNotificationChannel[] channels) (at Assets/Unity Notifications Wrapper/Scripts/GameNotificationsManager.cs:344)
    GameManager.InitializeNotifications () (at Assets/Scripts/GameManager.cs:1835)
    GameManager.Start () (at Assets/Scripts/GameManager.cs:280)

    than
    NullReferenceException: Object reference not set to an instance of an object
    NotificationSamples.GameNotificationsManager.Update () (at Assets/Unity Notifications Wrapper/Scripts/GameNotificationsManager.cs:163)

    And this broke all. This error in 163 - repeated and repeated.

    So if we go to GameNotificationsManager.cs:163 it's:
    // Check each pending notification for expiry, then remove it
    for (int i = PendingNotifications.Count - 1; i >= 0; --i)
    I try to debug and understandt that there is something wrong with PendingNotifications. If i try just to Debug.Log (PendingNotifications) - I already get error. After that I try to debug it with Visual Studio. And yes, whan code comes here, PendingNotifications == null.

    Than I try to check where the error exactly in my code, put Debug.Log on every steps and get that my code works fine until the part with notificationsManager.Initialize(channel)

    There is my code:

    public void InitializeNotifications()
    {
    Debug.Log("First log");
    GameNotificationChannel channel = new GameNotificationChannel("1", "test", "test notif");
    Debug.Log("Second log);
    notificationsManager.Initialize(channel);
    Debug.Log("Third log);
    }
    So first too debug.log works fine and whan it come to notificationsManager.Initialize(channel) i get an error
    ArgumentNullException: Value cannot be null.
    Parameter name: source

    So as i see - when I try to Initialize channel, it's not initialize and thats why PendingNotifications == null or PendingNotifications == null that's why channel dont initialized.

    And if i decide to build package I get errors like @alankarmisra.
    So now its realy big problem. I cant test my game and cant build aab or apk for it...

    Looks like I have 2 problems. First with Notifications and PendingNotifications == null, second with il2cpp that even cant create a build for me.
     
    Last edited: Aug 25, 2019
    IgorAherne likes this.
  25. LexaMV

    LexaMV

    Joined:
    Feb 20, 2018
    Posts:
    28
    Hi !

    The notification icon is located to the right, but how can I move it to the left? Is this really possible?
     
  26. Haukien

    Haukien

    Joined:
    Aug 20, 2014
    Posts:
    12
    Hi,

    We get this crash on iOS with version 1.0.3-preview.6 and Unity 2018.4.6f1.

    Fatal Exception: NSInvalidArgumentException
    0 CoreFoundation 0x1a79c554c __exceptionPreprocess
    1 libobjc.A.dylib 0x1a76e00c8 objc_exception_throw
    2 Foundation 0x1a7c790f8 +[NSString allocWithZone:]
    3 gameName 0x1010544b4 _ScheduleLocalNotification + 106 (UnityNotificationWrapper.m:106)
    4 gameName 0x1025cf260 (Missing)
    5 gameName 0x1025cf128 (Missing)
    6 gameName 0x101f619b4 (Missing)
    7 gameName 0x101de1988 (Missing)
    8 gameName 0x100feb1f0 RuntimeInvoker_TrueVoid_t22962CB4C05B1D89B55A6E1139F0E87A90987017(void (*)(), MethodInfo const*, void*, void**) + 38974 (Il2CppInvokerTable.cpp:38974)
    9 gameName 0x101c0cd5c il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) + 539 (Runtime.cpp:539)
    10 gameName 0x1016470c4 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) + 246 (ScriptingApi_Il2Cpp.cpp:246)
    11 gameName 0x10164ef44 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) + 347 (ScriptingInvocation.cpp:347)
    12 gameName 0x1016593ec MonoBehaviour::HandleNotifications(void*, int, MessageData&) + 71 (ScriptingInvocation.h:71)
    13 gameName 0x10147dcac GameObject::SendMessageAny(MessageIdentifier const&, MessageData&) + 1233 (GameObject.cpp:1233)
    14 gameName 0x1015abf98 SendMessageToEveryone(MessageIdentifier const&, MessageData) + 1311 (GameObjectUtility.cpp:1311)
    15 gameName 0x1015bcbb8 NotifyPlayerQuit(bool) + 298 (Player.cpp:298)
    16 gameName 0x1015bd3f4 PlayerCleanup(bool) + 570 (Player.cpp:570)
    17 gameName 0x101824824 UnityCleanup + 227 (LibEntryPoint.mm:227)
    18 gameName 0x100eeb7cc -[UnityAppController applicationWillTerminate:] + 406 (UnityAppController.mm:406)
    19 UIKitCore 0x1aba30560 -[UIApplication _terminateWithStatus:]
    20 UIKitCore 0x1ab1e0098 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
    21 UIKitCore 0x1ab1dfcf4 -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:]
    22 UIKitCore 0x1aba2696c -[UIApplication workspaceShouldExit:withTransitionContext:]
    23 FrontBoardServices 0x1acae3e28 -[FBSUIApplicationWorkspaceShim workspaceShouldExit:withTransitionContext:]
    24 FrontBoardServices 0x1acb13f6c __83-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:withAcknowledgement:]_block_invoke_2
    25 FrontBoardServices 0x1acaf7390 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
    26 FrontBoardServices 0x1acb13ef8 __83-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:withAcknowledgement:]_block_invoke
    27 libdispatch.dylib 0x1a766d088 _dispatch_client_callout
    28 libdispatch.dylib 0x1a766fdcc _dispatch_block_invoke_direct
    29 FrontBoardServices 0x1acb3c054 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
    30 FrontBoardServices 0x1acb3bd00 -[FBSSerialQueue _queue_performNextIfPossible]
    31 FrontBoardServices 0x1acb3c26c -[FBSSerialQueue _performNextFromRunLoopSource]
    32 CoreFoundation 0x1a7940b40 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
    33 CoreFoundation 0x1a7940a94 __CFRunLoopDoSource0
    34 CoreFoundation 0x1a7940200 __CFRunLoopDoSources0
    35 CoreFoundation 0x1a793b0cc __CFRunLoopRun
    36 CoreFoundation 0x1a793a978 CFRunLoopRunSpecific
    37 GraphicsServices 0x1b1a5b534 GSEventRunModal
    38 UIKitCore 0x1aba2b158 UIApplicationMain
    39 gameName 0x100ed5700 main + 41 (main.mm:41)
    40 libdyld.dylib 0x1a77baf04 start
     
    LLIeFs likes this.
  27. CalaveraX

    CalaveraX

    Joined:
    Jul 11, 2013
    Posts:
    143
    Hello there.
    I'm using the package, and each time i import it on a new project i have some issues with the UnitTests contained inside the package. and i have to enable playmode tests for all assemblies.
    Is there any way to fix this without having to enable the playstest???

     

    Attached Files:

  28. jonaspm99

    jonaspm99

    Joined:
    Feb 15, 2019
    Posts:
    2
    Dear @_Paulius,

    In our apps, the mobile notifications package works when doing local builds, but it is not working in Unity Cloud builds and no errors are shown in the console.

    The issue is that this piece of code is not ending. I mean, the Debug.Log() does never execute:

    Code (CSharp):
    1. IEnumerator RequestAuthorization()
    2. {
    3.   using (var req = new AuthorizationRequest(AuthorizationOption.Alert | AuthorizationOption.Badge, true))
    4.   {
    5.   while (!req.IsFinished)
    6.   {
    7.     yield return null;
    8.   };
    9.  
    10.   string res = "\n RequestAuthorization: \n";
    11.   res += "\n finished: " + req.IsFinished;
    12.   res += "\n granted :  " + req.Granted;
    13.   res += "\n error:  " + req.Error;
    14.   res += "\n deviceToken:  " + req.DeviceToken;
    15.   Debug.Log(res);
    16. }
    We do execute this function on each app launch.

    We are also using Firebase, Adjust and MoPub SDKs

    Thank you in advance for the help.

    [EDIT]
    Modified code and now seems to work. See newer response.
     
    Last edited: Sep 2, 2019
  29. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    @_Paulius there seems to be an issue with the device token on iOS when using the package.

    I'm using the latest 1.0.3 package.

    I have a third party plugin (Tapjoy) that adds native code to send back the device token. This has worked fine on apps where I use the legacy Unity notifications. The token gets printed out in XCode.

    Now, I've added the Mobile Notifications package and the device token is just empty.

    Also, I've noticed that the DeviceToken property of AuthorizationRequest is empty after authorization has been granted.

    I'm setting the registerForRemoteNotifications parameter to true, and I'm also enabling push in the player settings.
     
    leynier41 likes this.
  30. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @CalaveraX Could you try updating the package to 1.0.3? That should no longer happen with that version.

    @Haukien Is there anything specific about the notifications that are causing this crash? Could you please submit a bugreport using Unity's bug reporter in the editor (ideally including the script you're using to schedule your notifications)?

    @jonaspm99 that's strange I'm not sure why would it behave differently when the project is built using cloud build, we'll investigate this.

    @andymads Do you mean that Tapjoy is no longer returning the device token when you've added the package or is the notifications package not returning the token even when you're not using any other plugin related to notifications? Could you submit a bug report (ideally with a project that contains all the plugins that do anyting related to the notifications API)?
     
  31. LexaMV

    LexaMV

    Joined:
    Feb 20, 2018
    Posts:
    28
    Please answer me

     
  32. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @LexaMV what do you mean, could you send me a screenshot? Also what device are you using (at least on Pixels and Samsung phones the icon is always in the left)?.
     
  33. LexaMV

    LexaMV

    Joined:
    Feb 20, 2018
    Posts:
    28



    Icon is small and is position - right. Sony XA1
     
    Last edited: Aug 31, 2019
  34. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614


    Ok, my mistake with the package not returning the token - I had an error in my code. It works fine. Also, everything is working on the Tapjoy side now.

    One thing that's not working is getting the custom data from a push notification. Tapjoy allow you to specify a payload string when you send a push notification via their dashboard. I had hoped this would make it's way into the data in the notification but it doesn't. Any chance this can be fixed?
     
  35. MileSplit

    MileSplit

    Joined:
    Dec 25, 2012
    Posts:
    5
    Hey @_Paulius after upgrading to Unity 2019.2.2 I get this error when I build for iOS. Reading through the thread I have seen people with similar issues but it appears they had it fixed with the upgrade to 1.0.3. I am running the latest version but I am still getting the issue. MacOS as well. Any help would be greatly appreciated : )

    Mobile notifcations 1.0.3 and Unity 2019.2.2f1 iOS
    Failed running /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/il2cpp/build/il2cppcore/il2cppcore.dll --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --profiler-report --map-file-parser="/Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Tools/MapFileParser/MapFileParser" --directory="/Users/bcole/Documents/GitHub/Quickshot2/QuickShot 2/Temp/StagingArea/Data/Managed" --generatedcppdir="/Users/bcole/Documents/GitHub/Quickshot2/QuickShot 2/Temp/il2cppOutput/il2cppOutput"
    stdout: IL2CPP error for type 'NotificationSamples.GameNotificationChannel' in assembly '/Users/bcole/Documents/GitHub/Quickshot2/QuickShot 2/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll' Additional information: SafeArray element type Int64 is not supported. il2cpp.exe didn't catch exception: System.NotSupportedException: SafeArray element type Int64 is not supported. at Unity.IL2CPP.Marshaling.MarshalInfoWriters.ComSafeArrayMarshalInfoWriter.GetElementVariantType(MetadataType metadataType) at Unity.IL2CPP.Marshaling.MarshalInfoWriters.ComSafeArrayMarshalInfoWriter..ctor(ArrayType type) at Unity.IL2CPP.Marshaling.MarshalDataCollector.CreateMarshalInfoWriter(TypeReference type, MarshalType marshalType, MarshalInfo marshalInfo, Boolean useUnicodeCharSet, Boolean forByReferenceType, Boolean forFieldMarshaling, Boolean forReturnValue, Boolean forNativeToManagedWrapper, HashSet`1 typesForRecursiveFields) at Unity.IL2CPP.Marshaling.MarshalDataCollector.c_DisplayClass1_0.b1(FieldDefinition field) at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found) at Unity.IL2CPP.Marshaling.MarshalDataCollector.CreateMarshalInfoWriter(TypeReference type, MarshalType marshalType, MarshalInfo marshalInfo, Boolean useUnicodeCharSet, Boolean forByReferenceType, Boolean forFieldMarshaling, Boolean forReturnValue, Boolean forNativeToManagedWrapper, HashSet`1 typesForRecursiveFields) at Unity.IL2CPP.SourceWriter.WriteMarshalingDefinitions(IGeneratedMethodCodeWriter writer, TypeReference type, IInteropDataCollector interopDataCollector) at Unity.IL2CPP.SourceWriter.cDisplayClass7_0.b_0(IGeneratedMethodCodeWriter writer, TypeReference type) at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable`1 items, String fileName, Int64 chunkSize, Action`1 writeHeaderAction, Action`2 writeItemAction, Action`1 writeFooterAction, SourceWritingContext sourceWritingContext, Action`2 writeEnd) at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable`1 items, String fileName, Int64 chunkSize, Action`2 writeItemAction, SourceWritingContext sourceWritingContext, Action`2 writeEnd) at Unity.IL2CPP.SourceWriter.WriteMethodSourceFiles(NPath outputDirectory, SourceWritingContext sourceWritingContext, String fileName, IEnumerable`1 typeList, IMethodCollector methodCollector, Boolean writeMarshalingDefinitions) at Unity.IL2CPP.SourceWriter.Write(NPath outputDir, SourceWritingContext sourceWritingContext, AssemblyDefinition assemblyDefinition, IMethodCollector methodCollector) at Unity.IL2CPP.AssemblyConverter.Apply() at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable`1 assemblyDirectories, IEnumerable`1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[] searchDirectories, String entryAssemblyName, NPath[] extraTypesFiles) at il2cpp.Program.DoRun(String[] args) at il2cpp.Program.Run(String[] args) at il2cpp.Program.Main(String[] args) stderr:
    Unhandled Exception: System.NotSupportedException: SafeArray element type Int64 is not supported. at Unity.IL2CPP.Marshaling.MarshalInfoWriters.ComSafeArrayMarshalInfoWriter.GetElementVariantType(MetadataType metadataType) at Unity.IL2CPP.Marshaling.MarshalInfoWriters.ComSafeArrayMarshalInfoWriter..ctor(ArrayType type) at Unity.IL2CPP.Marshaling.MarshalDataCollector.CreateMarshalInfoWriter(TypeReference type, MarshalType marshalType, MarshalInfo marshalInfo, Boolean useUnicodeCharSet, Boolean forByReferenceType, Boolean forFieldMarshaling, Boolean forReturnValue, Boolean forNativeToManagedWrapper, HashSet`1 typesForRecursiveFields) at Unity.IL2CPP.Marshaling.MarshalDataCollector.c_DisplayClass1_0.b1(FieldDefinition field) at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found) at Unity.IL2CPP.Marshaling.MarshalDataCollector.CreateMarshalInfoWriter(TypeReference type, MarshalType marshalType, MarshalInfo marshalInfo, Boolean useUnicodeCharSet, Boolean forByReferenceType, Boolean forFieldMarshaling, Boolean forReturnValue, Boolean forNativeToManagedWrapper, HashSet`1 typesForRecursiveFields) at Unity.IL2CPP.SourceWriter.WriteMarshalingDefinitions(IGeneratedMethodCodeWriter writer, TypeReference type, IInteropDataCollector interopDataCollector) at Unity.IL2CPP.SourceWriter.cDisplayClass7_0.b_0(IGeneratedMethodCodeWriter writer, TypeReference type) at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable`1 items, String fileName, Int64 chunkSize, Action`1 writeHeaderAction, Action`2 writeItemAction, Action`1 writeFooterAction, SourceWritingContext sourceWritingContext, Action`2 writeEnd) at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable`1 items, String fileName, Int64 chunkSize, Action`2 writeItemAction, SourceWritingContext sourceWritingContext, Action`2 writeEnd) at Unity.IL2CPP.SourceWriter.WriteMethodSourceFiles(NPath outputDirectory, SourceWritingContext sourceWritingContext, String fileName, IEnumerable`1 typeList, IMethodCollector methodCollector, Boolean writeMarshalingDefinitions) at Unity.IL2CPP.SourceWriter.Write(NPath outputDir, SourceWritingContext sourceWritingContext, AssemblyDefinition assemblyDefinition, IMethodCollector methodCollector) at Unity.IL2CPP.AssemblyConverter.Apply() at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable`1 assemblyDirectories, IEnumerable`1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[] searchDirectories, String entryAssemblyName, NPath[] extraTypesFiles) at il2cpp.Program.DoRun(String[] args) at il2cpp.Program.Run(String[] args) at il2cpp.Program.Main(String[] args) at Program.Main(String[] args) in /Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/il2cppcore/Program.cs:line 24
    UnityEngine.Debug:LogError(Object) UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:126) UnityEditorInternal.Runner:RunNetCoreProgram(String, String, String, CompilerOutputParserBase, Action`1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:77) UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:501) UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:484) UnityEditorInternal.IL2CPPBuilder:Run() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
     
  36. Haukien

    Haukien

    Joined:
    Aug 20, 2014
    Posts:
    12
    @_Paulius it looks to be the same issue as rlewicki had. We solved it by adding a identifier variable to push generated for iOS.
     
  37. jonaspm99

    jonaspm99

    Joined:
    Feb 15, 2019
    Posts:
    2
    Dear @_Paulius,

    It seems to be working now, we changed the while loop with a WaitUntil() like this:

    Code (CSharp):
    1. yield return new WaitUntil(() => req.IsFinished);
     
  38. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    MileSplit likes this.
  39. jfperusse_bhvr

    jfperusse_bhvr

    Joined:
    Nov 11, 2014
    Posts:
    9
    Hi,

    We just installed the latest preview version (.6) of the package in order to fix the IL2CPP compile issue with Unity 2019.2.3f1.

    However, there is now a runtime issue associated with those changes.

    AndroidJavaException: java.lang.NoSuchMethodError: no non-static method with name='registerNotificationChannel' signature='(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;ZZZZ[II)V' in class Ljava.lang.Object;

    Looking at the source code, AndroidNotificationCenter.cs RegisterNotificationChannel now calls registerNotificationChannel with an int array of vibrationPattern, but the actual native plugin was not updated accordingly and still expects a long array.

    Is this a known issue?
     
  40. greatguss

    greatguss

    Joined:
    Feb 5, 2016
    Posts:
    2
    Hey,

    Are custom notification sounds for Android Channels supported yet?
     
  41. LexaMV

    LexaMV

    Joined:
    Feb 20, 2018
    Posts:
    28
    How to change this icon in notification?
     
  42. jfperusse_bhvr

    jfperusse_bhvr

    Joined:
    Nov 11, 2014
    Posts:
    9
    @_Paulius, we just noticed that the "IL2CPP Struct long[]" issue was not fixed in 2019.2.4f1 released today. Is there any chance to get a new preview version of the Mobile Notifications package with the Android runtime issue I mentionned above fixed (it's currently passing the wrong array type for the vibration to registerNotificationChannel). Thank you!
     
  43. MarcAubryBoissel

    MarcAubryBoissel

    Joined:
    Dec 1, 2016
    Posts:
    8
    Mobile Notification has possibility to send notification without trigger?
    Actualy for send notification on iOSNotificationCenter i use iOSNotificationTimeIntervalTrigger set to TimeInterval = new TimeSpan (0, 0, 0). It works, but is not a good programming pratice.

    Actual script:
    Code (CSharp):
    1.         private void SendNotification(string body)
    2.         {
    3.             iOSNotificationTimeIntervalTrigger timeTrigger = new iOSNotificationTimeIntervalTrigger()
    4.             {
    5.                 TimeInterval = new TimeSpan(0, 0, 0),
    6.                 Repeats = false
    7.             };
    8.  
    9.             iOSNotification notification = new iOSNotification()
    10.             {
    11.                 Identifier = "sending_notification",
    12.                 Title = "Title",
    13.                 Subtitle = "Subtitle",
    14.                 Body = body,
    15.                 ShowInForeground = true,
    16.                 ForegroundPresentationOption = (PresentationOption.Alert | PresentationOption.Sound),
    17.                 CategoryIdentifier = "categorySending",
    18.                 ThreadIdentifier = "thread1",
    19.                 Trigger = timeTrigger,
    20.             };
    21.             iOSNotificationCenter.ScheduleNotification(notification);
    22.         }
    23.  
    Desired but no result:
    Code (CSharp):
    1.         private void SendNotification(string body)
    2.         {
    3.             iOSNotification notification = new iOSNotification()
    4.             {
    5.                 Identifier = "sending_notification",
    6.                 Title = "Title",
    7.                 Subtitle = "Subtitle",
    8.                 Body = body,
    9.                 ShowInForeground = true,
    10.                 ForegroundPresentationOption = (PresentationOption.Alert | PresentationOption.Sound),
    11.                 CategoryIdentifier = "categorySending",
    12.                 ThreadIdentifier = "thread1",
    13.             };
    14.             iOSNotificationCenter.ScheduleNotification(notification);
    15.         }
    16.  
     
  44. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @jfperusse_bhvr yes that should be fixed in "1.0.4-preview.1" which got published earlier today.

    @LexaMV you can set the small icon in "Project Settings -> Mobile Notifications -> Android" if you use the id defined there when scheduling your notifications it should be displayed there.
     
  45. Molioo

    Molioo

    Joined:
    Mar 12, 2016
    Posts:
    7
    I am using Mobile Notifications on ios by creating new IOSNotification and scheduling it. I dont receive any remote notifications. Yet after uploading new build to appstore, I receive Missing Push Notification Entitlement warning. I am not sure if I need to enable it in provisioning profile as it says in mail? I am not sure if those local notifications i'm using are Push Notifications. Do I have to set Push Notifications entitlement etc on iOS when using this package only using local scheduled notifications?
     
  46. joseibanez

    joseibanez

    Joined:
    Nov 18, 2017
    Posts:
    6
    Hello @_Paulius I'm trying to disable sound by default for all iOS notifications, is that possible?
    I'm using Unity 2018.3.12f1 and Mobile Notifications 1.0.3-preview6
    Thank you in advance.
     
  47. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @Molioo you don't need to enable remote or push notifications toto send local notifications, if you don't enable remote notifications in "Project Settings -> Mobile Notifications" your app should no longer require the Push Notification Entitlement.

    @joseibanez Did include "AuthorizationOption.Sound" in your authorisation request? I believe notificaitons should no longer have any sound if it's not included.
     
    joseibanez likes this.
  48. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    163
    I get
    IL2CPP error for type 'GameNotificationChannel' in assembly: SafeArray element type Int64 is not supported
    when building.
    Building in Mono works.

    1.0.3-preview6 & 1.0.4-preview1
    2019.2.4f1 & 2019.2.5f1
     
    Last edited: Sep 12, 2019
  49. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,920
    This issue has been reported and corrected: https://issuetracker.unity3d.com/product/unity/issues/guid/1173310/

    The fix should be in 2019.2.6f1 when it is released.
     
  50. EDG_Chris

    EDG_Chris

    Joined:
    Jan 17, 2018
    Posts:
    1
    I'm having trouble with iOSNotificationCenter.GetLastRespondedNotification() always returning null, even when the application was opened via an interaction with a notification.

    Logs show the following, which sounds it like could be related:
    Code (CSharp):
    1. 2019-09-12 17:16:37.032502 tinymerge[877:253939] Warning: UNUserNotificationCenter delegate received call to -userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: but the completion handler was never called.
    Has anybody been able to use GetLastRespondedNotification successfully on iOS?