iOS-Capacitor-App-Tracking
Adds App Tracking Transparency for iOS 14
Added Capacitor 3.0 Support.
iOS 14 App Tracking Transparency.
Name
Returns
Type
getTrackingStatus
Promise
IOSAppTrackingStatus
requestPermission
Promise
IOSAppTrackingStatus
npm install capacitor-ios-app-tracking
npx cap sync
<key >NSUserTrackingUsageDescription</key >
<string >This identifier will be used to deliver personalized ads to you.</string >
getTrackingStatus() => Promise
import { AppTrackingTransparency } from "capacitor-ios-app-tracking" ;
useEffect ( ( ) => {
AppTrackingTransparency . getTrackingStatus ( ) . then ( ( status ) => {
console . log ( status ) ;
} ) ;
} , [ ] ) ;
requestPermission() => Promise
import { AppTrackingTransparency } from "capacitor-ios-app-tracking" ;
useEffect ( ( ) => {
AppTrackingTransparency . requestPermission ( ) . then ( ( status ) => {
console . log ( status ) ;
} ) ;
} , [ ] ) ;
interface IOSAppTrackingPlugin
export interface IOSAppTrackingPlugin {
getTrackingStatus ( ) : Promise < IOSAppTrackingResponse > ;
requestPermission ( ) : Promise < IOSAppTrackingResponse > ;
}
interface IOSAppTrackingResponse
interface IOSAppTrackingResponse {
code : string ;
status : IOSAppTrackingStatus ;
}
type IOSAppTrackingStatus
type IOSAppTrackingStatus =
| 'authorized'
| 'denied'
| 'unrequested'
| 'restricted' ;