跳过主要内容
返回插件
@capgo/capacitor-launch-navigator
教程
由 github.com/Cap-go

启动导航器

打开导航应用程序,如 Google Maps 或 Apple Maps,带有目的地的指示

指南

Launch Navigator 的教程

使用 @capgo/capacitor-launch-navigator

主要插件接口。

安装

bun add @capgo/capacitor-launch-navigator
bunx cap sync

此插件暴露的内容

  • navigate - 使用经纬度坐标导航到一个位置。
  • isAppAvailable - 检查是否有特定的导航应用程序可用。
  • getAvailableApps - 获取设备上可用的导航应用程序列表。
  • getSupportedApps - 根据当前平台获取支持的应用列表。

示例用法

navigate

使用经纬度坐标导航到一个位置。

import { LaunchNavigator } from '@capgo/capacitor-launch-navigator';

await LaunchNavigator.navigate({} as {
    /**
     * Destination coordinates [latitude, longitude]
     */
    destination: [number, number];

    /**
     * Optional navigation options
     */
    options?: NavigateOptions;
  });

isAppAvailable

检查是否支持特定的导航应用。

import { LaunchNavigator } from '@capgo/capacitor-launch-navigator';

await LaunchNavigator.isAppAvailable({} as {
    /**
     * App identifier to check
     */
    app: IOSNavigationApp | AndroidNavigationApp | string;
  });

getAvailableApps

获取设备上可用的导航应用列表。

import { LaunchNavigator } from '@capgo/capacitor-launch-navigator';

await LaunchNavigator.getAvailableApps();

getSupportedApps

根据当前平台获取支持的应用列表。

import { LaunchNavigator } from '@capgo/capacitor-launch-navigator';

await LaunchNavigator.getSupportedApps();

全局参考