{"id":15141931,"url":"https://github.com/eddyverbruggen/nativescript-directions","last_synced_at":"2025-06-13T09:38:46.635Z","repository":{"id":10970099,"uuid":"67728871","full_name":"EddyVerbruggen/nativescript-directions","owner":"EddyVerbruggen","description":":point_up_2: :point_right: :point_down: :point_left: Open the Maps app to show directions to anywhere you like","archived":false,"fork":false,"pushed_at":"2022-12-10T22:53:56.000Z","size":5962,"stargazers_count":83,"open_issues_count":22,"forks_count":21,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-21T16:11:24.628Z","etag":null,"topics":["directions","maps","nativescript","nativescript-plugin","waypoints"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EddyVerbruggen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-08T18:20:07.000Z","updated_at":"2024-05-30T15:45:24.000Z","dependencies_parsed_at":"2023-01-13T16:15:50.577Z","dependency_job_id":null,"html_url":"https://github.com/EddyVerbruggen/nativescript-directions","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/EddyVerbruggen/nativescript-directions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-directions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-directions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-directions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-directions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EddyVerbruggen","download_url":"https://codeload.github.com/EddyVerbruggen/nativescript-directions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-directions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259620800,"owners_count":22885827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["directions","maps","nativescript","nativescript-plugin","waypoints"],"created_at":"2024-09-26T09:20:38.105Z","updated_at":"2025-06-13T09:38:46.530Z","avatar_url":"https://github.com/EddyVerbruggen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NativeScript Directions plugin\n\n[![NPM version][npm-image]][npm-url]\n[![Downloads][downloads-image]][npm-url]\n[![Twitter Follow][twitter-image]][twitter-url]\n\n[build-status]:https://travis-ci.org/EddyVerbruggen/nativescript-directions.svg?branch=master\n[build-url]:https://travis-ci.org/EddyVerbruggen/nativescript-directions\n[npm-image]:http://img.shields.io/npm/v/nativescript-directions.svg\n[npm-url]:https://npmjs.org/package/nativescript-directions\n[downloads-image]:http://img.shields.io/npm/dm/nativescript-directions.svg\n[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social\u0026label=Follow%20me\n[twitter-url]:https://twitter.com/eddyverbruggen\n\n\u003e ⚠️ Looking for NativeScript 7 compatibilty? Go to [the NativeScript/plugins repo](https://github.com/NativeScript/plugins/tree/master/packages/directions).\n\n## Installation\nFrom the command prompt go to your app's root folder and execute:\n\n```\ntns plugin add nativescript-directions\n```\n\n## Usage\n\n### Demo app (XML + TypeScript)\nWant to dive in quickly? Check out [the demo app](demo)! Otherwise, continue reading.\n\nYou can run the demo app from the root of the project by typing `npm run demo.ios.device` or `npm run demo.android`.\n\n\u003cimg src=\"https://raw.githubusercontent.com/EddyVerbruggen/nativescript-directions/master/media/directions-animated.gif\" width=\"320px\" height=\"570px\"/\u003e\n\n### Demo app (Angular)\nThis plugin is part of the [plugin showcase app](https://github.com/EddyVerbruggen/nativescript-pluginshowcase/tree/master/app/mapping) I built using Angular.\n\n## API\n\n### `available`\nNot all devices have the Google (Android) or Apple (iOS) Maps app installed. Well, most do of course, but on an Android simulator you may be out of luck, so let's check beforehand:\n\n##### JavaScript\n```js\n// require the plugin\nvar Directions = require(\"nativescript-directions\").Directions;\n\n// instantiate the plugin\nvar directions = new Directions();\n\ndirections.available().then(\n  function(avail) {\n    console.log(avail ? \"Yes\" : \"No\");\n  }\n);\n```\n\n##### TypeScript\n```typescript\n// require the plugin\nimport { Directions } from \"nativescript-directions\";\n\n// instantiate the plugin\nlet directions = new Directions();\n\ndirections.available().then(avail =\u003e {\n    console.log(avail ? \"Yes\" : \"No\");\n});\n```\n\n### `navigate`\nThis function opens the native Maps app with a predefined `from` and `to` address.\n\nIf you don't pass `from` the current location of the user will be used.\n\nIf an `address` is specified then `lat` and `lng` will be ignored.\n\nIf you pass in an Array of `to` addresses, then the last item is the destination, the others become 'waypoints'.\n\nNote that if there's an ocean in between `from` and `to` you won't be able to get directions, don't blame this plugin for that 😁\n\n##### JavaScript\n```js\ndirections.navigate({\n  from: { // optional, default 'current location'\n    lat: 52.215987,\n    lng: 5.282764\n  },\n  to: { // either pass in a single object or an Array (see the TypeScript example below)\n    address: \"Hof der Kolommen 34, Amersfoort, Netherlands\"\n  }\n  // for platform-specific options, see the TypeScript example below.\n}).then(\n  function() {\n    console.log(\"Maps app launched.\");\n  },\n  function(error) {\n    console.log(error);\n  }\n);\n```\n\n##### TypeScript\n```typescript\ndirections.navigate({\n  from: { // optional, default 'current location'\n    lat: 52.215987,\n    lng: 5.282764\n  },\n  to: [{ // if an Array is passed (as in this example), the last item is the destination, the addresses in between are 'waypoints'.\n    address: \"Hof der Kolommen 34, Amersfoort, Netherlands\",\n  },\n  {\n    address: \"Aak 98, Wieringerwerf, Netherlands\"\n  }],\n  type: \"walking\", // optional, can be: driving, transit, bicycling or walking\n  ios: {\n    preferGoogleMaps: true, // If the Google Maps app is installed, use that one instead of Apple Maps, because it supports waypoints. Default true.\n    allowGoogleMapsWeb: true // If waypoints are passed in and Google Maps is not installed, you can either open Apple Maps and the first waypoint is used as the to-address (the rest is ignored), or you can open Google Maps on web so all waypoints are shown (set this property to true). Default false.\n  },\n  android: {\n    newTask: true // Start as new task. This means it will start a new history stack instead of using the current app. Default true.\n  }\n}).then(() =\u003e {\n    console.log(\"Maps app launched.\");\n}, error =\u003e {\n    console.log(error);\n});\n```\n\n## Future work\n* Perhaps add Android-specific options like opening the map in StreetView mode, or pre-defining the transportation type (walk/bike/car).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyverbruggen%2Fnativescript-directions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddyverbruggen%2Fnativescript-directions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyverbruggen%2Fnativescript-directions/lists"}