npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@atoui-zahreddine/capacitor-mapbox-navigation

v1.11.0

Published

This is a plugin for mapbox navigation.

Downloads

8

Readme

Notice:

This is a fork from the original plugin capacitor-mapbox-navigation to fix some issues and add some features. The original plugin was not maintained and had some issues. feel free to use this plugin and contribute to it.

capacitor-mapbox-navigation

Capacitor plugin to implement Turn-by-Turn Mapbox navigation.

RoadMap

  • Bridge event binding.

Installation Requirements

Before installing the SDK, you will need to gather the appropriate credentials. The SDK requires two pieces of sensitive information from your Mapbox account. If you don't have a Mapbox account: sign up and navigate to your Account page. You'll need:

  • A public access token: From your account's tokens page, you can either copy your default public token or click the Create a token button to create a new public token.
  • A secret access token with the Downloads:Read scope.
  1. From your account's tokens page, click the Create a token button.
  2. From the token creation page, give your token a name and make sure the box next to the Downloads:Read scope is checked.
  3. Click the Create token button at the bottom of the page to create your token.
  4. The token you've created is a secret token, which means you will only have one opportunity to copy it somewhere secure.

Install

npm install capacitor-mapbox-navigation
npx cap sync

IOS instructions

Configure your secret token.

Your secret token enables you to download the SDK directly from Mapbox. To use your secret token, you will need to store it in a .netrc file in your home directory (not your project folder). This approach helps avoid accidentally exposing your secret token by keeping it out of your application's source code. Depending on your environment, you may have this file already, so check first before creating a new one.

The .netrc file is a plain text file that is used in certain development environments to store credentials used to access remote servers. The login should always be mapbox. It should not be your personal username used to create the secret token. To set up the credentials required to download the SDK, add the following entry to your .netrc file:

machine api.mapbox.com
login mapbox
password YOUR_SECRET_MAPBOX_ACCESS_TOKEN

To configure your public access token, open your project's Info.plist file and add a MBXAccessToken key whose value is your public access token.

Permission

In order for the SDK to track the user’s location as they move along the route, set NSLocationWhenInUseUsageDescription to:

Shows your location on the map and helps improve the map.

Users expect the SDK to continue to track the user’s location and deliver audible instructions even while a different application is visible or the device is locked. Go to the Signing & Capabilities tab. Under the Background Modes section, enable “Audio, AirPlay, and Picture in Picture” and “Location updates”. (Alternatively, add the audio and location values to the UIBackgroundModes array in the Info tab.)


Android Specific Instructions

Place your secret token in your android app's top level gradle.properties file:

MAPBOX_DOWNLOADS_TOKEN=SECRET_TOKEN_HERE

Open up your project-level build.gradle file. Declare the Mapbox Downloads API's releases/maven endpoint in the repositories block.

allprojects {
    repositories {
        maven {
            url 'https://api.mapbox.com/downloads/v2/releases/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                // Do not change the username below.
                // This should always be `mapbox` (not your username).
                username = "mapbox"
                // Use the secret token you stored in gradle.properties as the password
                password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
            }
        }
    }
}

Place your public token in values/mapbox_access_token.xml android/app/src/main/res/values/mapbox_access_token.xml

<resources xmlns:tools="http://schemas.android.com/tools">
    <string name="mapbox_access_token"><PUT_YOUR_ACCESS_TOKEN_HERE></string>
</resources>

For more information you can read the docs provided by Mapbox.

Permission

If you plan to display the user's location on the map or get the user's location information you will need to add the ACCESS_COARSE_LOCATION permission in your application's AndroidManifest.xml. You also need to add ACCESS_FINE_LOCATION permissions if you need access to precise location.

<manifest ... >
  <!-- Always include this permission -->
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

  <!-- Include only if your app benefits from precise location access. -->
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</manifest>

API

echo(...)

echo(options: { value: string; }) => any

| Param | Type | | ------------- | ------------------------------- | | options | { value: string; } |

Returns: any


show(...)

show(options: MapboxNavOptions) => any

| Param | Type | | ------------- | ------------------------------------------------------------- | | options | MapboxNavOptions |

Returns: any


history()

history() => any

Returns: any


requestPermissions()

requestPermissions() => any

Returns: any


checkPermissions()

checkPermissions() => any

Returns: any


Interfaces

MapboxNavOptions

| Prop | Type | | ------------- | ------------------- | | routes | {} | | mapType | string |

LocationOption

| Prop | Type | | --------------- | ------------------- | | latitude | number | | longitude | number |

MapboxResult

| Prop | Type | | ------------ | -------------------------------------------------------- | | status | 'success' | 'failure' | | type | 'on_failure' | 'on_cancelled' | 'on_stop' | | data | string |

PermissionStatus

| Prop | Type | | -------------- | ----------------------------------------------------------- | | location | PermissionState |

Type Aliases

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'