How to use ATTrackingManager in Expo

Viewed 644

According to recent apple update, ALL apps published to AppStore since 26.4.2021, are required to use App Tracking Transparency framework, if they are requiring user name, email, phone or any user generated content.

Our app requires user name, email and phone number to register user into the app in order to use it. We are not using Segment, AdMob or FacebookAds in our app, but since these libraries can be used in expo managed, we are obliged to check the boxes which custom user content we use, when deploying the app to the AppStore. (https://docs.expo.io/distribution/app-stores/#ios-specific-guidelines)

According to Apple Tracking Transparency I have set the infoPlist key (NSUserTrackingUsageDescription)in app.json, but can't figure out how to show the alert dialog, since ATTrackingManager class, which prompts the user permission is not present in expo and haven't found this type of permission in expo-permissions either. Any clue on how to approach this issue? Thanks a bunch.

2 Answers

I didn’t want to downvote the answer given by the OP. However, he only pointed out to the documentation which wasn't clear to me. Luckily, I contacted Expo team and they helped me. Eventually, my app got approved.

So, in order to get the permission in an expo app you need to:

  1. install expo-ads-admob library.
  2. import requestPermissionsAsync() like this

import { requestPermissionsAsync, getPermissionsAsync, } from 'expo-ads-admob'

  1. call it like this in an async function await requestPermissionsAsync()

  2. Add the required line in the infoPList as written in the docs

Source: https://github.com/expo/expo/blob/master/apps/native-component-list/src/screens/AdMobScreen.tsx#L141-L144

just found out expo-ads-admob is able to requestPermissionsAsync() and getPermissionsAsync() in Expo 41

Related