Skip to content

Instantly share code, notes, and snippets.

@secondsun
Created June 13, 2013 18:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secondsun/242063868b09db030331 to your computer and use it in GitHub Desktop.
Save secondsun/242063868b09db030331 to your computer and use it in GitHub Desktop.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
Registrar r = new Registrar(new URL("http://192.168.1.194:8080/ag-push/rest/registry/device"));
PushConfig config = new PushConfig("272275396485");
config.setMobileVariantId("342ff906-3772-415c-ad39-b25faa18d332");
config.setAlias("someGuy");
r.register(getApplicationContext(), config, new Callback<Void>() {
private static final long serialVersionUID = 1L;
@Override
public void onSuccess(Void arg0) {
Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Exception arg0) {
Log.e("ERROR", arg0.getMessage(), arg0);
Toast.makeText(getApplicationContext(), "Failure", Toast.LENGTH_LONG).show();
}
});
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment