lunes, 5 de enero de 2015

Android: Testing notifications easely

Para probar notificaciones rapidamente, sin hacer un seteo de un servidor y su configuracion (rapido en dev):

2- Configurar ApiKey (Server key, desde API console) y SenderId (project id desde API Console)
3- Completar el titulo y mensaje, y darle al boton "Send GCM..."

Desde la app, para registrar el token:

private void sendRegistrationIdToBackend() {
String url = "http://gcm4public.appspot.com/registergcmclient?senderId=" + SENDER_ID + "&registrationId=" + regid;
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet(url);
    try {
        httpclient.execute(httpget);
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

No hay comentarios:

Publicar un comentario