microg/GmsCore · critical · IOException
ERROR_MISSING_INSTANCEID_SERVICE
ERROR_MISSING_INSTANCEID_SERVICE
Error message
ERROR_MISSING_INSTANCEID_SERVICE
What it means
InstanceIdRpc.sendRegisterMessage throws ERROR_MISSING_INSTANCEID_SERVICE when initialize() cannot resolve any package on the device that hosts the instance-ID registration service (ACTION_INSTANCE_ID_SERVICE / the IID receiver). Without a provider app (Play Services or microG) the registration intent has no target package.
Source
Thrown at play-services-iid/src/main/java/org/microg/gms/iid/InstanceIdRpc.java:279
intent.setPackage("com.google.example.invalidpackage");
selfAuthToken = PendingIntent.getBroadcast(context, 0, intent, 0);
}
return selfAuthToken;
}
private static synchronized String getRequestId() {
return Integer.toString(lastRequestId++);
}
private void sendRegisterMessage(Bundle data, KeyPair keyPair, String requestId) throws IOException {
long elapsedRealtime = SystemClock.elapsedRealtime();
if (nextAttempt != 0 && elapsedRealtime <= nextAttempt) {
Log.w(TAG, "Had to wait for " + interval + ", that's still " + (nextAttempt - elapsedRealtime));
throw new IOException(ERROR_BACKOFF);
}
initialize();
if (iidPackageName == null) {
throw new IOException(ERROR_MISSING_INSTANCEID_SERVICE);
}
Intent intent = new Intent(ACTION_C2DM_REGISTER);
intent.setPackage(iidPackageName);
data.putString(EXTRA_GMS_VERSION, Integer.toString(getGmsVersionCode(context)));
data.putString(EXTRA_OS_VERSION, Integer.toString(SDK_INT));
data.putString(EXTRA_APP_VERSION_CODE, Integer.toString(getSelfVersionCode(context)));
data.putString(EXTRA_APP_VERSION_NAME, getSelfVersionName(context));
data.putString(EXTRA_CLIENT_VERSION, "iid-" + GMS_VERSION_CODE);
data.putString(EXTRA_APP_ID, InstanceID.sha1KeyPair(keyPair));
String pub = base64encode(keyPair.getPublic().getEncoded());
data.putString(EXTRA_PUBLIC_KEY, pub);
data.putString(EXTRA_SIGNATURE, sign(keyPair, context.getPackageName(), pub));
intent.putExtras(data);
intent.putExtra(EXTRA_APP, getSelfAuthToken());
sendRequest(intent, requestId);
}
private static String sign(KeyPair keyPair, String... payload) {View on GitHub (pinned to 157c9d86ac)
Solutions
- Verify Google Play Services is installed and up to date on the device (check GooglePlayServicesUtil.isGooglePlayServicesAvailable / ensure updated via the provider)
- Ensure the device/setup provides the IID service: on de-Googled devices install and configure microG with the required GMS components
- If supporting devices without Play Services, use an alternate push transport (e.g. UnifiedPush) instead of InstanceID/GCM
- Check that the app depends on a compatible com.google.android.gms:play-services-iid version matching the device's GMS
Example fix
// before
String token = InstanceID.getInstance(ctx).getToken(senderId, "GCM");
// after
int status = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(ctx);
if (status != ConnectionResult.SUCCESS) {
GoogleApiAvailability.getInstance().getErrorDialog(activity, status, REQ).show();
return;
}
String token = InstanceID.getInstance(ctx).getToken(senderId, "GCM"); Defensive patterns
Strategy: validation
Validate before calling
int status = GoogleApiAvailability.getInstance()
.isGooglePlayServicesAvailable(context);
if (status != ConnectionResult.SUCCESS) {
GoogleApiAvailability.getInstance()
.getErrorDialog(activity, status, 0).show();
} Try / catch
try {
String token = instanceId.getToken(senderId, "GCM");
} catch (IOException e) {
if ("ERROR_MISSING_INSTANCEID_SERVICE".equals(e.getMessage())) {
promptUserToInstallOrUpdatePlayServices();
}
} Prevention
- Check Play Services availability at app startup with GoogleApiAvailability
- Test on devices/emulators without Google APIs
- Offer a non-GMS push fallback (e.g. UnifiedPush) for de-Googled devices
When it happens
Trigger: Calling getToken on a device with no Google Play Services (or an outdated/broken install), or on a microG build where the com.google.android.gms IID service component is missing or disabled, so iidPackageName remains null after initialize().
Common situations: Running a GCM/FCM-dependent app on devices without Play Services (e.g. Kindle, emulators without Google APIs, de-Googled ROMs without microG installed); Play Services mid-update or disabled by the user; wrong build variant relying on microG that isn't configured.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Access denied, missing google package permission for
- No acceptable module " + moduleId + " found. Local version i
- Required caller information missing
- (String) res
- UnsupportedOperationException
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/eb8ba63c3e5e096a.
Report an issue: GitHub.