microG GmsCore
repository·master·Indexed 28 days ago
https://github.com/microg/gmscoreA FLOSS framework providing implementations of Google Play Services APIs to enable compatible apps to run on alternative Android environments. Includes documentation on map style variants, asset conversion for MapLibre, Firebase authentication via IdentityToolkitClient, and Advertising ID management through IAdvertisingIdService.
What's inside microg-gmscore
- microG Services is a Free/Libre Open Source Software (FLOSS) framework designed to allow applications that require Google Play Services to function on systems where Google Play Services is not available.
Convert map assets (sprites and fonts) for microG styles
masterTo prepare assets for use in an application (e.g.,
play-services-maps-core-mapbox), usespreetfor sprites andbuild_pbf_glyphsfor fonts.Note: microG combines Open Sans Regular with Roboto Regular to ensure no glyphs are missing. A symbolic link is often used in the assets folder to point the font stack specification
Open Sans Regular,Arial Unicode MS RegulartoRoboto Regularto prevent MapLibre rendering failures.$ cp style-microg-{satellite,normal}-{mapbox,stadia}.json style-stadia-outdoors.json style-mapbox-outdoors-v12.json ../../play-services-maps-core-mapbox/src/main/assets/ $ spreet sprite_sources/ ../../play-services-maps-core-mapbox/src/main/assets/sprites $ spreet --retina sprite_sources/ ../../play-services-maps-core-mapbox/src/main/assets/sprites@2x $ build_pbf_glyphs --overwrite -c fonts/combinations.json fonts/ ../../play-services-maps-core-mapbox/src/main/assets $ rm -r ../../play-services-maps-core-mapbox/src/main/assets/OpenSans\ RegularDownload microG and follow installation instructions
masterFor all downloads, installation instructions, and setup guidance, refer to the official microG wiki.
https://github.com/microg/GmsCore/wikiConfigure Maputnik for microG styles
masterWhen using Maputnik to edit microG styles, it is convenient to point the
spriteandglyphssources to Mapbox-hosted sources instead of the localasset://scheme used in the app."sprite": "mapbox://sprites/microg/cjui4020201oo1fmca7yuwbor/8fkcj5fgn4mftlzuak3guz1f9", "glyphs": "mapbox://fonts/microg/{fontstack}/{range}.pbf",Identify microG map style variants
mastermicroG provides several map style JSON files for different schema requirements and vendors:
style-microg-normal-openmaptiles.json: Pure OpenMapTiles schema version. Sources are set to Stadia but can be modified for other schema-compliant vendors like MapTiler.style-microg-normal-stadia.json: Variant containing Stadia custom layers.style-microg-normal-mapbox.json: Historic, unmaintained variant for Mapbox.style-microg-satellite-*.json: Satellite layer variants (the Stadia variant is almost pure OpenMapTiles, though OpenMapTiles does not specify a satellite layer).style-stadia-outdoors.json: Identical to Stadia's Outdoors style but includes added microG metadata.
Get providers for an email address
masterUsegetProvidersForEmailto check which authentication providers (e.g., Google, Password, Phone) are associated with a specific email address. This returns aCreateAuthUriResponsecontaining available sign-in methods.Initialize IdentityToolkitClient
masterThe
IdentityToolkitClientis used to interact with the Firebase Identity Toolkit API. It requires aContext, anapiKey, and optional parameters for Android-specific identification to include in request headers.Constructor Parameters:
context: AndroidContext.apiKey: The Firebase API key.packageName(optional): The Android package name. If provided, it is sent in theX-Android-Packageheader.certSha1Hash(optional): AByteArrayrepresenting the SHA1 certificate hash. If provided, it is converted to an uppercase hex string and sent in theX-Android-Certheader.
Sign in with email and password
masterUsesignInWithEmailAndPasswordto authenticate an existing user. It requires an email and password. On success, it returns the authentication tokens and the user's account information via theIFirebaseAuthCallbacksinterface.Sign in with phone number (SMS)
masterUsesignInWithPhoneNumberto authenticate via SMS. This process involves providing aPhoneAuthCredentialwhich includes the phone number and thesmsCodereceived. The service also supports automatic SMS interception via aBroadcastReceiverfor theandroid.provider.Telephony.SMS_RECEIVEDintent to extract 6-digit codes.Sign in with custom token
masterUsesignInWithCustomTokenwhen you have a token generated by a backend server. This method accepts atokenstring and returns the user's authentication state and account info.Get access token using refresh token
masterUsegetAccessTokento retrieve a fresh access token using a providedrefreshToken. This is useful for maintaining a session when the current access token expires.Create a new user with email and password
masterUsecreateUserWithEmailAndPasswordto register a new user. This method takes an email and password, and upon success, returns aGetTokenResponsecontaining the access and refresh tokens, along with theGetAccountInfoUserobject representing the new user's profile.