Skip to content

Instantly share code, notes, and snippets.

@sedouard
Created May 20, 2014 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sedouard/92a0f334f8b9a8621c1e to your computer and use it in GitHub Desktop.
Save sedouard/92a0f334f8b9a8621c1e to your computer and use it in GitHub Desktop.
package com.example.crossplatformpush;
import android.content.Context;
import com.microsoft.windowsazure.notifications.NotificationsHandler;
import com.microsoft.windowsazure.messaging.*;
public class Handler extends NotificationsHandler {
@Override
public void onRegistered(Context context, String gcmregId){
super.onRegistered(context, gcmregId);
//register to notification hub
NotificationHub hub = new NotificationHub("<NOTIFICATION HUB NAME>", "<NOTIFICATION HUB CONNECTION STRING>",
context);
try{
hub.register(gcmregId, "breaking_news", "user:1234");
}
catch(Exception e){
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment