Вот мой C2DMReceiver:
public class C2DMReceiver extends C2DMBaseReceiver {
public C2DMReceiver() {
// Email address currently not used by the C2DM Messaging framework
super("dummy@gmail.com");
}
@Override
public void onRegistered(Context context, String registrationId)
throws java.io.IOException {
// The registrationId should be send to your applicatioin server.
// We just log it to the LogCat view
// We will copy it from there
Log.e("C2DM", "Registration ID arrived: Fantastic!!!");
Log.e("C2DM", registrationId);
};
@Override
protected void onMessage(Context context, Intent intent) {
Log.e("C2DM", "Message: Fantastic!!!");
// Extract the payload from the message
Bundle extras = intent.getExtras();
if (extras != null) {
System.out.println(extras.get("payload"));
// Now do something smart based on the information
}
}
@Override
public void onError(Context context, String errorId) {
Log.e("C2DM", "Error!");
}
}
Что он должен сделать, это показать "Сообщение: Фантастика !!!"в LogCat, но это не где увидеть.Что я делаю неправильно?У меня есть регистрационный идентификатор в моем веб-приложении (написано на PHP), но не повезло.Я получаю это обратно, когда выполняю запрос:
id=0:1311936686518981%48da2b9fb207fa19
Использование руководства: http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html