Search Unity

Azure Notification Hub not working in WUP app made on Unity3D

Discussion in 'Windows' started by FelipePlets, Dec 23, 2016.

  1. FelipePlets

    FelipePlets

    Joined:
    Jul 26, 2016
    Posts:
    4
    I'm trying to use Azure Notification Hub to handle my MPNS WUP app notifications on a Unity3D generated project.

    I used the following article to setup it in Visual Studio 2015 on the generated project: Getting started with Notification Hubs for Windows Universal Platform Apps

    The app compiles and once it runs the following async code...

    Code (CSharp):
    1. var result = await hub.RegisterNativeAsync(channel.Uri);
    ...the console prints the following log:

    Code (CSharp):
    1. Exception thrown: 'System.Runtime.InteropServices.COMException' in Microsoft.WindowsAzure.Messaging.Managed.dll
    2. WinRT information: ResourceMap Not Found.
    3.  
    4. Exception thrown: 'System.TypeInitializationException' in Microsoft.WindowsAzure.Messaging.Managed.dll
    5. Exception thrown: 'System.AggregateException' in mscorlib.ni.dll
    6. Exception thrown: 'System.AggregateException' in mscorlib.ni.dll
    7. Exception thrown: 'System.AggregateException' in mscorlib.ni.dll
    8. Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in Microsoft.WindowsAzure.Messaging.Managed.dll
    9. Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
    10. Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
    11. Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
    12. Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
    13. OnWebCamTextureToMatHelperDisposed
    14. (Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/UnityEngineDebugBindings.gen.cpp Line: 45)
    15.  
    16.  
    17. Exception thrown: 'Microsoft.WindowsAzure.Messaging.RegistrationException' in mscorlib.ni.dll
    18. Unhandled 'Platform.COMException' exception caught! - 'The text associated with this error code could not be found.
    19.  
    20. The type initializer for 'Microsoft.WindowsAzure.Messaging.Http.Resources' threw an exception.', Sender: '<null>'. Missing try/catch blocks.
    21. (Filename: C:\buildslave\unity\build\PlatformDependent/MetroPlayer/MetroDebug.cpp Line: 41)
    My current setup is:
    • Unity3D 5.4.3p4
    • Visual Studio 2015
    • WindowsAzure.Messaging.Managed 0.1.7.9 (I also tried with 0.1.7.8 that is used in the getting started article)
     
    adrianokerber likes this.
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    This doesn't really look like something Unity could affect. Did you try debugging it? Does the same not happen in a UWP application without Unity? Are you sure you're calling that API from the correct thread?
     
  3. FelipePlets

    FelipePlets

    Joined:
    Jul 26, 2016
    Posts:
    4
    Hello @Tautvydas-Zilys thanks for your answer.
    After that we tested on a native WUP project using the same how-to article and had the same problem.

    In the end we discovered it was not related to Unity at all but to the Azure Account.
    The Pricing Tier on the the Microsoft Azure Notification Hub was defined as Free (limit to 500 Active Devices), after changing it to Basic (limit to 200K Active Devices) the exception is gone.

    This was a really bad experience and took some days for our team to find out the reason as the exception has no real link to the actual issue nor the Microsoft Azure Dashboard has any notification related to the limit on the push registrations.
     
  4. TungLT

    TungLT

    Joined:
    Dec 12, 2013
    Posts:
    1
    Hi guys,
    I'm trying to find a solution to integrate Notification Hubs to my unity app. So do you guys have any guide about it?