{"id":15141822,"url":"https://github.com/nativescript/nativescript-urlhandler","last_synced_at":"2025-09-29T10:31:06.383Z","repository":{"id":141979549,"uuid":"154470294","full_name":"NativeScript/nativescript-urlhandler","owner":"NativeScript","description":"NativeScript URL Handler Plugin","archived":true,"fork":true,"pushed_at":"2018-10-25T17:12:12.000Z","size":2521,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2024-05-23T10:01:13.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"hypery2k/nativescript-urlhandler","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NativeScript.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-10-24T08:59:05.000Z","updated_at":"2023-01-25T23:16:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"34cf1075-24d2-43bf-a6c3-b264ba26f05d","html_url":"https://github.com/NativeScript/nativescript-urlhandler","commit_stats":{"total_commits":171,"total_committers":10,"mean_commits":17.1,"dds":"0.17543859649122806","last_synced_commit":"7484c551c7c240b609f5e634091287e457b4e7b5"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fnativescript-urlhandler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fnativescript-urlhandler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fnativescript-urlhandler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fnativescript-urlhandler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NativeScript","download_url":"https://codeload.github.com/NativeScript/nativescript-urlhandler/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234609323,"owners_count":18859849,"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":[],"created_at":"2024-09-26T09:02:21.218Z","updated_at":"2025-09-29T10:31:04.828Z","avatar_url":"https://github.com/NativeScript.png","language":"TypeScript","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=H8TR8246RCDJG"],"categories":[],"sub_categories":[],"readme":"# NativeScript URL Handler Plugin  ![apple](https://cdn3.iconfinder.com/data/icons/picons-social/57/16-apple-32.png) ![android](https://cdn4.iconfinder.com/data/icons/logos-3/228/android-32.png)\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/hypery2k/nativescript-urlhandler.svg)](https://greenkeeper.io/)\n[![Build Status](https://travis-ci.org/hypery2k/nativescript-urlhandler.svg?branch=master)](https://travis-ci.org/hypery2k/nativescript-urlhandler)\n[![Donate with Bitcoin](https://martinreinhardt-online.de/assets/img/button-badge-bitcoin.svg)](bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D)\n\n[![npm version](https://badge.fury.io/js/nativescript-urlhandler.svg)](http://badge.fury.io/js/nativescript-urlhandler)[![Maintainability](https://api.codeclimate.com/v1/badges/7db5d127cfd7529f7b9a/maintainability)](https://codeclimate.com/github/hypery2k/nativescript-urlhandler/maintainability)\n\n[![NPM](https://nodei.co/npm/nativescript-urlhandler.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/nativescript-urlhandler/)\n\n\u003ca name=\"donation\"\u003e\u003c/a\u003e\n\u003e Feel free to **donate**\n\u003e\n\u003e \u003ca target=\"_blank\" href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=H8TR8246RCDJG\"\u003e\n\u003e \u003cimg alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif\"/\u003e\n\u003e \u003c/img\u003e\u003c/a\u003e\n\u003e Or donate Bitcoins: bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D\n\u003e\n\u003e [![Bitcoin](https://martinreinhardt-online.de/bitcoin.png)](bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D)\n\u003e\n\u003e Also via [greenaddress](https://greenaddress.it/pay/GA3ZPfh7As3Gc2oP6pQ1njxMij88u/)\n\n\n\n# Usage\n\nJust add App links to your app, see iOS and Android instructions below, and register a handler for the URL data.\n\nSee this example for Angular:\n```typescript\nimport { Component, OnInit } from \"@angular/core\";\nimport { handleOpenURL, AppURL } from 'nativescript-urlhandler';\n\n@Component({\n  selector: \"gr-main\",\n  template: \"\u003cpage-router-outlet\u003e\u003c/page-router-outlet\u003e\"\n})\nexport class AppComponent {\n    constructor() {\n    } \n    \n    ngOnInit(){\n        handleOpenURL((appURL: AppURL) =\u003e {\n            console.log('Got the following appURL', appURL);\n        });\n     }\n}\n\n```\nAnd for pure NativeScript:\n```javascript\nvar handleOpenURL = require(\"nativescript-urlhandler\").handleOpenURL;\n\nhandleOpenURL(function(appURL) {\n  console.log('Got the following appURL', appURL);\n});\n\n```\nOr as TypeScript:\n```typescript\nimport { handleOpenURL, AppURL } from 'nativescript-urlhandler';\n\nhandleOpenURL((appURL: AppURL) =\u003e {\n  console.log('Got the following appURL', appURL);\n});\n\n```\n\n\n\n## Installation\n\n```bash\n$ tns plugin add nativescript-urlhandler\n```\n\nOr if you want to use the development version (nightly build), which maybe not stable!:\n\n```bash\n$ tns plugin add nativescript-urlhandler@next\n```\n\n\n### Android\n\nReplace *myapp* with your desired scheme and set launchMode to *singleTask*\n```xml\n\u003cactivity android:name=\"com.tns.NativeScriptActivity\" ... android:launchMode=\"singleTask\"...\u003e\n        ...\n    \u003cintent-filter\u003e\n    \u003cdata android:scheme=\"myapp\" /\u003e \n    \u003caction android:name=\"android.intent.action.VIEW\" /\u003e \n    \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e \n    \u003ccategory android:name=\"android.intent.category.BROWSABLE\" /\u003e \n    \u003c/intent-filter\u003e\n```\n\nFor example:\n\n```xml\n\u003cactivity android:name=\"com.tns.NativeScriptApplication\" android:label=\"@string/app_name\" android:launchMode=\"singleTask\"\u003e\n  \u003cintent-filter\u003e\n      \u003caction android:name=\"android.intent.action.MAIN\" /\u003e\n      \u003ccategory android:name=\"android.intent.category.LAUNCHER\" /\u003e\n  \u003c/intent-filter\u003e\n  \u003cintent-filter\u003e\n      \u003caction android:name=\"android.intent.action.VIEW\" /\u003e\n      \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n      \u003ccategory android:name=\"android.intent.category.BROWSABLE\" /\u003e \n      \u003cdata android:scheme=\"myapp\" android:host=\"__PACKAGE__\" /\u003e\n  \u003c/intent-filter\u003e\n\u003c/activity\u003e\n\n```\n\nThe android:launchMode=\"singleTask\" tells the Android operating system to launch the app with a new instance of the activity, or use an existing one. Without this your app will launch multiple instances of itself which is no good.\n\n### iOS\n\n```xml\n\u003ckey\u003eCFBundleURLTypes\u003c/key\u003e\n\u003carray\u003e\n    \u003cdict\u003e\n        \u003ckey\u003eCFBundleURLName\u003c/key\u003e\n        \u003cstring\u003ecom.yourcompany.myapp\u003c/string\u003e\n    \u003c/dict\u003e\n    \u003cdict\u003e\n        \u003ckey\u003eCFBundleURLSchemes\u003c/key\u003e\n        \u003carray\u003e\n            \u003cstring\u003emyapp\u003c/string\u003e\n        \u003c/array\u003e\n    \u003c/dict\u003e\n\u003c/array\u003e\n```\n\n# FAQ\n\n## Callback handling\n\nThe \"handleOpenURL\" callback must be called before application initialization, otherwise you'll see this error in the console:\n\n```\n    No callback provided. Please ensure that you called \"handleOpenURL\" during application init!\n``` \n\n## Webpack\n\n### TypeScript Config\n\nIf your Webpack Build is failing, try adapting your tsconfig to this:\n\n```\n    \"compilerOptions\": {\n        \"module\": \"commonjs\",\n        \"target\": \"es5\",\n        \"experimentalDecorators\": true,\n        \"emitDecoratorMetadata\": true,\n        \"noEmitHelpers\": true,\n        \"noEmitOnError\": true,\n        \"lib\": [\n            \"es6\",\n            \"dom\",\n            \"es2015.iterable\"\n        ],\n        \"baseUrl\": \".\",\n        \"paths\": {\n            \"*\": [\n                \"./node_modules/tns-core-modules/*\",\n                \"./node_modules/*\"\n            ]\n        }\n    },\n    \"exclude\": [\n        \"node_modules\",\n        \"platforms\",\n        \"**/*.aot.ts\"\n    ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript%2Fnativescript-urlhandler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnativescript%2Fnativescript-urlhandler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript%2Fnativescript-urlhandler/lists"}