showUserMessage static method
Implementation
static Future<String> showUserMessage() async {
try {
var info =
await UserMessagingPlatform.instance.requestConsentInfoUpdate();
log("UMP:[Consent Status] - ${info.consentStatus.name}");
if (info.consentStatus == ConsentStatus.required) {
try {
await UserMessagingPlatform.instance.showConsentForm();
} catch (e) {
log(e.toString());
}
final status =
await AppTrackingTransparency.requestTrackingAuthorization();
log("ATT:[Status] - ${status.name}");
if (status == TrackingStatus.authorized) {
final id = await AppTrackingTransparency.getAdvertisingIdentifier();
log("ATT:[Advertisement ID] - $id");
return id;
}
return status.name;
} else {
final status =
await AppTrackingTransparency.requestTrackingAuthorization();
log("ATT:[Status] - ${status.name}");
if (status == TrackingStatus.authorized) {
final id = await AppTrackingTransparency.getAdvertisingIdentifier();
log("ATT:[Advertisement ID] - $id");
return id;
}
return status.name;
}
// UserHelperApi().setDeviceInfoToServer();
} catch (error) {
log("UMP:[Message No Config] - $error");
final status =
await AppTrackingTransparency.requestTrackingAuthorization();
log("ATT:[Status] - ${status.name}");
if (status == TrackingStatus.authorized) {
final id = await AppTrackingTransparency.getAdvertisingIdentifier();
log("ATT:[Advertisement ID] - $id");
return id;
}
return status.name;
}
}