このコードを使用して、gcm でデバイスの登録を解除しようとしました:
btn = (Button)findViewById(R.id.button1);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GCMRegistrar.unregister(MainActivity.this);
}
});
メソッドでこのコードを使用したことを知ってonCreate()
...しかし、通知に通知を送信しようとするとDeviceID
、通知が到着します。これは、登録解除プロセスが成功しなかったことを意味します
じぶんのonCreate()
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
txt = (TextView)findViewById(R.id.txt_nn);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals(""))
{
GCMRegistrar.register(this, "344XXXXXXX571");
}
else
{
Log.v("Info : ", "Already registered");
}
txt.setText(regId);
btn = (Button)findViewById(R.id.button1);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GCMRegistrar.unregister(MainActivity.this);
}
});
}
マイ LogCat
12-25 17:16:31.290: E/Trace(18754): error opening trace file: No such file or directory (2)
12-25 17:16:31.425: V/Info :(18754): Already registered
12-25 17:16:31.485: D/libEGL(18754): loaded /system/lib/egl/libEGL_mali.so
12-25 17:16:31.490: D/libEGL(18754): loaded /system/lib/egl/libGLESv1_CM_mali.so
12-25 17:16:31.495: D/libEGL(18754): loaded /system/lib/egl/libGLESv2_mali.so
12-25 17:16:31.500: D/(18754): Device driver API match
12-25 17:16:31.500: D/(18754): Device driver API version: 10
12-25 17:16:31.500: D/(18754): User space API version: 10
12-25 17:16:31.500: D/(18754): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Wed Sep 12 17:53:53 KST 2012
12-25 17:16:31.540: D/OpenGLRenderer(18754): Enabling debug mode 0
12-25 17:16:43.015: D/GestureDetector(18754): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 2 mFalseSizeCnt:0
12-25 17:16:43.020: D/GCMRegistrar(18754): resetting backoff for com.example.test09_gsm
12-25 17:16:43.020: V/GCMRegistrar(18754): Unregistering app com.example.test09_gsm
12-25 17:16:46.865: V/GCMBroadcastReceiver(18754): onReceive: com.google.android.c2dm.intent.REGISTRATION
12-25 17:16:46.865: V/GCMBroadcastReceiver(18754): GCM IntentService class: com.example.test09_gsm.GCMIntentService
12-25 17:16:46.870: V/GCMBaseIntentService(18754): Acquiring wakelock
12-25 17:16:46.895: V/GCMBaseIntentService(18754): Intent service name: GCMIntentService-IntentService-1
12-25 17:16:46.895: E/GCMRegistrar(18754): internal error: retry receiver class not set yet
12-25 17:16:46.895: V/GCMRegistrar(18754): Registering receiver
12-25 17:16:46.895: D/GCMBaseIntentService(18754): handleRegistration: registrationId = null, error = null, unregistered = com.example.test09_gsm
12-25 17:16:46.895: D/GCMRegistrar(18754): resetting backoff for com.example.test09_gsm
12-25 17:16:46.895: V/GCMRegistrar(18754): Saving regId on app version 1
12-25 17:16:46.940: D/onUnregistered(18754): APA91bFrB0pJOQqq7MxSe-so7fbqh70jLpX6bRrcRIdW6py1EuxletPfGr5ZlkytrenbdnJskdWXckjIcHWsvtKXppZ1PsMbhfkzIc9BmX26brIVDTCRSXPey7POA3UqP6EexMD4w_plFQkVy-9pacCqbBfV0k91dQ
12-25 17:16:46.940: V/GCMBaseIntentService(18754): Releasing wakelock
GCM でデバイスの登録を解除し、今後の通知を受け取らないようにする方法を教えてください。
前もって感謝します