Android: InstanceID deleteToken 范围

Android: InstanceID deleteToken Scope

我在应用程序中实施 Google 云消息传递。首先,我使用 InstanceID 获取令牌,下一步是在我的服务器中注册设备,然后我获取一个 HttpResponse。根据此响应,我想删除令牌并在我的服务器中注销设备。这是代码:

// [START register_for_gcm]
            InstanceID instanceID = InstanceID.getInstance(this);
            final String token = instanceID.getToken(manager.getSenderID(),GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
            // [END get_token]
            Log.i(TAG, "GCM Registration Token: " + token);
            final Context context = ApplicationContextProvider.getContext();
            mRegisterTask = new AsyncTask<Void, Void, Void>() {
                @Override
                protected Void doInBackground(Void... params) {
                    HttpResponse response = manager.registerDevice(context, App.getInstance().getAppId(), token, null, null);
                    // At this point all attempts to register with the app server failed, so we need to unregister the device from GCM - the app will try to register again when
                    // it is restarted. Note that GCM will send an unregistered callback upon completion, but GCMIntentService.onUnregistered() will ignore it.
                    if (String.valueOf(response.getStatusLine().getStatusCode()).equals(200)==false){
                        instanceID.deleteToken(token, scope);
                        manager.unregister(context);
                    }
                    return null;
                }

                @Override
                protected void onPostExecute(Void result) {
                    mRegisterTask = null;
                }
            };
            mRegisterTask.execute(null, null, null);

我在 Android 开发人员 Google Developers InstanceID 中查找,我找到了 deleteToken(String authorizedEntity, String scope)。 authorizedEntity是在getToken()方法中获取到的token,但是我不知道作用域是什么。 有人可以帮助我吗?

范围是 "GCM" 或常量

GoogleCloudMessaging.INSTANCE_ID_SCOPE

authorizedEntity 是您的项目编号。这是 reference link