跳过内容

开始

GitHub

您可以使用我们的AI辅助设置来安装插件。将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-appinsights` plugin in my project.

如果您更喜欢手动设置,请按照以下命令安装插件并遵循以下平台特定的说明:

终端窗口
bun add @capgo/capacitor-appinsights
bunx cap sync
import { CapacitorAppInsights } from '@capgo/capacitor-appinsights';

初始化 AppInsights SDK

import { CapacitorAppInsights } from '@capgo/capacitor-appinsights';
await CapacitorAppInsights.init({} as {
partnerId: string; // Provided by our business unit
partnerKey: string; // Provided by our business unit
});

初始化后设置或更新用户 ID

import { CapacitorAppInsights } from '@capgo/capacitor-appinsights';
await CapacitorAppInsights.setUserId({} as { userId: string });

获取当前SDK状态

import { CapacitorAppInsights } from '@capgo/capacitor-appinsights';
await CapacitorAppInsights.getState();
export interface PanelSDKState {
initCompleted: boolean; // SDK initialization status
jobScheduled: boolean; // Background job scheduling status
permissionAcquired: boolean; // Required permissions status
}

本页面由插件生成。 src/definitions.ts重新同步时,公共API上游发生变化。

如果您正在使用 Getting Started 来规划仪表板和API操作,请将其连接到 使用@capgo/capacitor-appinsights 为native能力在使用@capgo/capacitor-appinsights中 API概述 为API概述中的实现细节 介绍 为《介绍》中实现细节 API Keys 为《API Keys》中实现细节,以及 设备 为《设备》中实现细节