-1

i am trying to connect xamarin app with Azure notification hub. for registration i am using this code in onTokenRefresh method.

     var client = new MobileServiceClient(App.MobileServiceUrl);
                var push = client.GetPush();
                var reg = new Registration("??????????", new List<string> { "someTag" });
                await push.RegisterAsync(reg);

Registration object needs "deviceId" as first parameter. where to get this id from, in xamarin's Android project ?

Raas Masood
  • 1,475
  • 3
  • 23
  • 61

1 Answers1

2

You can obtain that id via the static Firebase instance token property

FirebaseInstanceId.Instance.Token

So this should work:

var reg = new Registration(FirebaseInstanceId.Instance.Token, new List<string> { "someTag" });
SushiHangover
  • 73,120
  • 10
  • 106
  • 165