How do you request consent to use ad identifier for personalized ads in xamarin.forms?
Is there examples or library?
How do you request consent to use ad identifier for personalized ads in xamarin.forms?
Is there examples or library?
@BrianKramer-3128 Not clear your need, can you elaborate on what you are trying to achieve?
For ios14.5. So admob can deliver personalized ads. I believe we need to request permission to access the advertising identifier.
Hi BrianKramer-3128,
Welcome to our Microsoft Q&A platform!
To request the permission, your app must support App Tracking Transparency.
First, you need to create a new string key NSUserTrackingUsageDescription in the Info.plist file.
Then we can display a system-permission alert request via DenpendencyService.
1.Create a interface
public interface IAdvertisingService
{
void RequestPermission();
}
2.Call the method RequestTrackingAuthorizationAsync which in AppTrackingTransparency framework
[assembly: Dependency(typeof(AdvertisingService))]
namespace Demo.iOS
{
class AdvertisingService : IAdvertisingService
{
public void RequestPermission()
{
AppTrackingTransparency.ATTrackingManager.RequestTrackingAuthorizationAsync();
}
}
}
3.Call RequestPermission
DependencyService.Get<IAdvertisingService>().RequestPermission();
About advertising in iOS, you can refer to the documentation AdSupport.
Regards,
Kyle
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
7 people are following this question.