getStatus(): Promise<AppTrackingTransparencyStatus>
requestPermission(): Promise<AppTrackingTransparencyStatus>
- In your module (e.g.
app.module.ts
)
...
import { AppTrackingTransparency } from 'capacitor-app-tracking-transparency'
@NgModule({
...
providers: [
...
AppTrackingTransparency,
],
})
export class AppModule {}
- In your component or service (e.g.
permission.service.ts
)
...
import { AppTrackingTransparency, AppTrackingTransparencyStatus } from 'capacitor-app-tracking-transparency'
@Injectable()
export class PermissionService {
constructor(private att: AppTrackingTransparency) {}
async requestATT() {
const status = await this.att.getStatus()
if(status === AppTrackingTransparencyStatus.notDetermined) {
const new_status = await this.att.requestPermission()
}
}
}
-
Status "unrequested" has been changed to status "notDetermined" to more closely match the native enum https://developer.apple.com/documentation/apptrackingtransparency/attrackingmanager/authorizationstatus
-
Added full support for Capacitor 3 and removed compatibility with Capacitor 2