我添加了模块GCM,它与APPENGINE正确配合使用 . 我已经完成了文档说来注册和接收来自Endpoint的消息 .

现在我不想取消注册设备,我不知道它是怎么做的......任何想法?

我测试了gcm.unregister()和regService.unregister(Idphone).execute()但它不起作用

我试图做一个新的AsyncTask类GcmUnRegistrationAsyncTask扩展AsyncTask {private static Registration regService = null;私有GoogleCloudMessaging gcm;私有上下文;

private static final String SENDER_ID = "892982546498";

public GcmUnRegistrationAsyncTask(Context context) {
    this.context = context;
}

@Override
protected String doInBackground(Void... params) {
    if (regService == null) {

        Registration.Builder builder = new Registration.Builder(AndroidHttp.newCompatibleTransport(), new AndroidJsonFactory(), null)
                .setRootUrl("https://myproject.appspot.com/_ah/api/");
        regService = builder.build();

    }

    String msg = "";
    try {
        if (gcm == null) {
            gcm = GoogleCloudMessaging.getInstance(context);
        }
        String regId = gcm.register(SENDER_ID);
        msg = "Device registered, registration ID=" + regId;

    MainActivity.token=regId;


 regService.unregister(regId).execute();
gcm.unregister();
    } catch (IOException ex) {
        ex.printStackTrace();
        msg = "Error: " + ex.getMessage();
    }
    return msg;
}

@Override
protected void onPostExecute(String msg) {
  //  Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
    Logger.getLogger("unREGISTRATION").log(Level.INFO, msg);
    Toast.makeText(context, MainActivity.token, Toast.LENGTH_LONG).show();
}

}

我想展示所有设备......