microg/GmsCore · error · RuntimeException
Push permission not granted to $packageName
Error message
Push permission not granted to $packageName
What it means
PushRegisterService.ensureAppRegistrationAllowed throws RuntimeException with this message when the app is unknown to the GCM database, the user declined (or did not respond to) the push-permission prompt, so registration is aborted for a package lacking push permission.
Source
Thrown at play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt:73
suspend fun ensureAppRegistrationAllowed(context: Context, database: GcmDatabase, packageName: String) {
if (!GcmPrefs.get(context).isEnabled) throw RuntimeException("GCM disabled")
val app = database.getApp(packageName)
if (app == null && GcmPrefs.get(context).confirmNewApps) {
val accepted: Boolean = suspendCoroutine { continuation ->
val i = Intent(context, AskPushPermission::class.java)
i.putExtra(AskPushPermission.EXTRA_REQUESTED_PACKAGE, packageName)
i.putExtra(AskPushPermission.EXTRA_RESULT_RECEIVER, object : ResultReceiver(null) {
override fun onReceiveResult(resultCode: Int, resultData: Bundle?) {
continuation.resume(resultCode == Activity.RESULT_OK)
}
})
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
i.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
context.startActivity(i)
}
if (!accepted) {
throw RuntimeException("Push permission not granted to $packageName")
}
} else if (app?.allowRegister == false) {
throw RuntimeException("Push permission not granted to $packageName")
}
}
suspend fun completeRegisterRequest(context: Context, database: GcmDatabase, request: RegisterRequest, requestId: String? = null): Bundle = suspendCoroutine { continuation ->
PushRegisterManager.completeRegisterRequest(context, database, requestId, request) {
val errorMsg = it.getString(EXTRA_ERROR)
Log.w(TAG, "completeRegisterRequest error: $errorMsg")
if (errorMsg == PushRegisterManager.attachRequestId(ERROR_INVALID_FID, requestId) && !request.delete) {
Log.d(TAG, "completeRegisterRequest register error, You need to call delete first before you can re-register")
request.delete = true
request.response
request.delete = false
PushRegisterManager.completeRegisterRequest(context, database, requestId, request) { result ->
continuation.resume(result)
}View on GitHub (pinned to 157c9d86ac)
Solutions
- Grant the app notification/push permission (via the AskPushPermission flow or system settings)
- Deny registration gracefully by replying with a permission error
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at play-services-core/src/main/kotlin/org/microg/gms/gcm/PushRegisterService.kt:73 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/0cdc7299fd990a2b.
Report an issue: GitHub.