getAndroidServerAuthCode method
Retrieves the Android server authentication code for Play Games.
Returns a Future that resolves with the server authentication code as a String,
or null
if the process fails.
Logs any platform exceptions that occur during the retrieval of the auth code.
Implementation
@override
Future<String?> getAndroidServerAuthCode() async {
final String? authCode;
try {
// Invoke the native method to get the Android server auth code.
authCode =
await methodChannel.invokeMethod<String>('getAndroidServerAuthCode');
} on PlatformException catch (e) {
// Log the error if the platform throws an exception.
_log.severe('Failed to get Android server auth code: ${e.message}');
return null;
}
_log.fine('Successfully retrieved Android server auth code');
return authCode;
}