开始
复制一个带有安装步骤和本插件的完整Markdown指南的设置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-app-tracking-transparency`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/app-tracking-transparency/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
您可以使用我们的AI-Assisted Setup来安装插件。将Capgo技能添加到您的AI工具中,使用以下命令:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins然后使用以下提示:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-app-tracking-transparency` plugin in my project.如果您更喜欢手动设置,请按照以下命令安装插件并遵循以下平台特定的说明:
bun add @capgo/capacitor-app-tracking-transparencybunx cap sync导入
导入import { AppTrackingTransparency } from '@capgo/capacitor-app-tracking-transparency';getStatus
Section titled “getStatus”获取当前跟踪授权状态,用户不会被提示。
import { AppTrackingTransparency } from '@capgo/capacitor-app-tracking-transparency';
const { status } = await AppTrackingTransparency.getStatus();if (status === 'authorized') { console.log('Tracking is authorized');}requestPermission
Section titled “requestPermission”请求用户授权以访问跟踪相关的应用数据。
显示原生iOS跟踪权限对话框。
import { AppTrackingTransparency } from '@capgo/capacitor-app-tracking-transparency';
const { status } = await AppTrackingTransparency.requestPermission();switch (status) { case 'authorized': console.log('User authorized tracking'); break; case 'denied': console.log('User denied tracking'); break; case 'restricted': console.log('Tracking is restricted'); break; case 'notDetermined': console.log('Status not determined'); break;}复制到剪贴板
类型参考AppTrackingStatusResponse
Section titled “Type Reference”Section titled “AppTrackingStatusResponse”
export interface AppTrackingStatusResponse { /** * The current tracking authorization status. * * @since 1.0.0 */ status: AppTrackingStatus;}AppTrackingStatus
AppTrackingStatus跟踪授权状态的可能值
export type AppTrackingStatus = 'authorized' | 'denied' | 'notDetermined' | 'restricted';真实来源
真实来源本页面是由插件的 src/definitions.ts当公共API在上游发生变化时,请重新同步。
继续从开始
继续从开始如果您正在使用 开始 来规划仪表板和API操作,请将其与 使用@capgo/capacitor-app-tracking-transparency 为native能力在使用@capgo/capacitor-app-tracking-transparency API概述 为实现细节在API概述 简介 为实现细节在简介 API密钥 为实现细节在API密钥,并且 设备 为实现细节在设备。