android - 当我从android中的应用程序注销时如何禁用推送通知

标签 android

我在注销按钮上使用了以下代码,请点击查看:

GCMRegistrar.unregister(mContext);

    Intent unregIntent = new Intent(
            "com.google.android.c2dm.intent.UNREGISTER");
    unregIntent.putExtra("app",
            PendingIntent.getBroadcast(mContext, 0, new Intent(), 0));
    unregIntent.putExtra("sender", Data.GCM_REGISTERED_ID);
    mContext.startService(unregIntent);

最佳答案

我仍然没有找到解决方案,但作为快速修复,我在注销后使用 bool 标志强制禁用了通知代码..

关于android - 当我从android中的应用程序注销时如何禁用推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16457639/

相关文章:

没有 requestLocationUpdates 不会触发 Android 地理围栏

android - Google+ 和 AppEngine 身份验证

android - 使用默认的android图像查看器显示图片

android - 如何使用 Roboelectric 测试在 ViewTreeObserver 的 onGlobalLayout 中执行的代码?

java - 使用 sharedPreferences 的 onPause 和 onResume 方法

android - 适用于 Android 的 Google Analytics v2 beta 5 导致 SIGSEGV

android - 如何在android中获取联系人的号码类型?

android - HttpResponseCache 不缓存文件

删除后Android SQLite更改rowid

android - 偶尔延迟 10 秒开始 Activity