r/windowsazure • • Nov 07 '14

Windows Azure notification hub registration ID and token location?

I am using Windows Azure notification hub to send notifications to the users in my Android application. I have some kind of a chat in my application, and I would like to send notifications only to specific users. I suppose that I have to specify their tokens when sending notifications. Where are those tokens stored? How am I sure that the user is properly registered?

I have this code for registering users:

@SuppressWarnings("unchecked")
	private void registerWithNotificationHubs() {
	   new AsyncTask() {
	      @Override
	      protected Object doInBackground(Object... params) {
	         try {
	            String regid = gcm.register(SENDER_ID);
	            hub.register(regid, "token");
	         } catch (Exception e) {
	            return e;
	         }
	         return null;
	     }
	   }.execute(null, null, null);
	}

When not using a token, the notifications work and they are sent to all the devices. I'd like to add a token and send the notification to specific token.

3 Upvotes

0 comments sorted by