protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); textViewMsg = FindViewById <TextView>(Resource.Id.textViewMsg); // TODO: Customize these values to your own const string CONNECTION_STRING = "YOUR-HUB-CONNECTION-STRING"; const string HUB_NAME = "YOUR-HUB-NAME"; #region Check to ensure user has used their own Connection String and Hub Name if (CONNECTION_STRING == "YOUR-HUB-CONNECTION-STRING") { Log("You must change the CONNECTION_STRING to your own for the sample to work!"); return; } if (HUB_NAME == "YOUR-HUB-NAME") { Log("You must enter your own Hub Name for the sample to work!"); return; } #endregion Log("Registering for Remote Notifications..."); NotificationHub.Initialize(Application, HUB_NAME, CONNECTION_STRING); Log("Device Token: {0}", NotificationHub.PushChannel); NotificationHub.SetListener(new NotificationListener()); }
public MainPage() { InitializeComponent(); // Create Notification Hub NotificationHub.NotificationMessageReceived += OnNotificationMessageReceived; NotificationHub.Initialize(Constants.ConnectionString, Constants.HubName); }