setPlatformType static method
Huawei devices supports Huawei Mobile Services (HMS) and other Android devices supports Google Mobile Services (GMS). Some Huawei devices supports both of HMS and GMS. In this situation appmate SDK works over GMS. But developers can set running platform type by calling setPlatformType method. If the device is not supporting the passed platform type, onError will be triggered.
platformType
Platform type
Callbacks BaseResponse
and GenericError in case of failure
Implementation
static Future<BaseResponse> setPlatformType(String platformType) async {
if (!Platform.isAndroid) {
BaseResponse result =
new BaseResponse(false, GenericError('Unsupported platform!'));
return result;
}
List<Object?>? response = await _channel
.invokeMethod('setPlatformType', {"platformType": platformType});
BaseResponse result = new BaseResponse(false, null);
if (response != null) {
if (response[0] != null) {
result = new BaseResponse(response[0].toString() == "true", null);
}
if (response[1] != null) {
GenericError error =
GenericError.fromJson(json.decode(response[1]!.toString()));
result = new BaseResponse(false, error);
}
return result;
}
return result;
}