Skip to main content
Version: Next

Google Play Services

What if google play services are unavailable in android os devices ?

Developing android application for android OS devices that do not contain google play services such as pos machine, hand terminal etc. At this point, we should consider to not use below-listed components’ functions and plugins.

Plugins & Extentions

  • Fabric (sf-plugin-fabric deprecated)
  • Firebase (sf-plugin-firebase)
  • GoogleSafetyNet (sf-extension-utils)

Components

  • MapView
  • Location
  • Notifications

Note: Devices' Android API levels are also effect the usage.

Smartface Android Emulator

Smartface emulator is unable to run without google play services.

Smartface Security

@smartface/security module provides security tools (e.g. GoogleSafetyNet) for Smartface applications.

https://www.npmjs.com/package/@smartface/security

Google Play Services

import { GooglePlayServices } from "@smartface/security";
if (System.OS === System.OSType.Android) {
GooglePlayServices.upgradeSecurityProvider()
.then(() => {
console.info(
"Provider is up-to-date, app can make secure network calls."
);
})
.catch((errorCode) => {
console.error("Error code: ", errorCode);
});
}

Google SafetyNet

import { GoogleSafetyNet } from "@smartface/security";
if (System.OS === System.OSType.ANDROID) {
const googleSafetyNet = new GoogleSafetyNet({
apiKey: "**********",
});
if (googleSafetyNet.isPlayServicesAvailable()) {
let nonce = googleSafetyNet.generateNonce();
// Nonce should be at least 16 bytes length
googleSafetyNet
.sendAttestationRequest(nonce)
.then((jws) => {
console.info(`JWS ${jws}`);
})
.catch((e) => {
console.error(e);
});
} else {
console.info(
"Google Play services are not available. You cannot proceed further"
);
}
}