{"record":{"id":"c2cbebfc95619ecb","repo":"microg/GmsCore","slug":"gcm-disabled","errorCode":null,"errorMessage":"GCM disabled","messagePattern":"GCM disabled","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt","lineNumber":56,"sourceCode":"            val continued = AtomicBoolean(false)\n            intent.putExtra(CheckinService.EXTRA_RESULT_RECEIVER, object : ResultReceiver(null) {\n                override fun onReceiveResult(resultCode: Int, resultData: Bundle?) {\n                    if (continued.compareAndSet(false, true)) continuation.resume(resultData ?: Bundle.EMPTY)\n                }\n            })\n            ForegroundServiceContext(context).startService(intent)\n            Handler().postDelayed({\n                if (continued.compareAndSet(false, true)) continuation.resume(Bundle.EMPTY)\n            }, 10000L)\n        }\n        if (resultData.getLong(CheckinService.EXTRA_NEW_CHECKIN_TIME, 0L) + lastCheckin == 0L) {\n            throw RuntimeException(\"No checkin available\")\n        }\n    }\n}\n\nsuspend fun ensureAppRegistrationAllowed(context: Context, database: GcmDatabase, packageName: String) {\n    if (!GcmPrefs.get(context).isEnabled) throw RuntimeException(\"GCM disabled\")\n    val app = database.getApp(packageName)\n    if (app == null && GcmPrefs.get(context).confirmNewApps) {\n        val accepted: Boolean = suspendCoroutine { continuation ->\n            val i = Intent(context, AskPushPermission::class.java)\n            i.putExtra(AskPushPermission.EXTRA_REQUESTED_PACKAGE, packageName)\n            i.putExtra(AskPushPermission.EXTRA_RESULT_RECEIVER, object : ResultReceiver(null) {\n                override fun onReceiveResult(resultCode: Int, resultData: Bundle?) {\n                    continuation.resume(resultCode == Activity.RESULT_OK)\n                }\n            })\n            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)\n            i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)\n            i.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)\n            context.startActivity(i)\n        }\n        if (!accepted) {\n            throw RuntimeException(\"Push permission not granted to $packageName\")\n        }","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt#L38-L74","documentation":"PushRegisterService.ensureAppRegistrationAllowed throws RuntimeException(\"GCM disabled\") when GCM is turned off in microG preferences (GcmPrefs.isEnabled is false). The failing condition is a configuration/state issue, not a bad argument: push registration is requested while the user or configuration disabled GCM entirely.","triggerScenarios":"Thrown at play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable cloud messaging in microG settings","Catch the exception and reply with the appropriate registration error to the requesting app"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}