nativescript - NativeScript URL Handler Plugin 无法正常工作
问题描述
我正在尝试将此插件与 Nativescript Angular 一起使用。我按照教程Nativescript Url Handler
在我的 app.component.ts 中:
ngOnInit() {
handleOpenURL((appURL: AppURL) => {
console.log('Got the following appURL', appURL);
alert(appURL);
});
}
在 android 清单中:
<activity
android:name=".activities.Activity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http"
android:host="example.com"
android:pathPrefix="/"/>
</intent-filter>
当我输入我的谷歌浏览器导航器:http://example.com/或http://www.example.com/时,它不起作用。任何帮助,我将不胜感激。
解决方案
我认为在 Chrome 的地址栏上点击 URL 不会打开您的应用程序。它应该是一个链接,当您单击该链接时,它会尝试打开您的应用程序。
例如,即使是 YouTube - 如果您点击 youtube.com,它仍然会在 Chrome 浏览器中打开它。如果您单击 Youtube 视频链接可能来自 Google 搜索,那么它会尝试启动该应用程序。
也不要忘记尝试干净的构建。
推荐阅读
- python - 使用请求模块发布数据时,在 Mod_Security 请求错误上出现 403 被禁止
- python - 如何在我的请求 Django 中从模板发送数据
- javascript - 如何创建不可变数组?
- reactjs - CORS 在开发机器上发出带有 HTTP 触发器的 Azure Functions
- mysql - 在运行时从 spring 连接 MySql 数据库
- linux - windows子系统Linux在终端找不到文件
- javascript - 如何在具有相似值但不同的数组中循环值?
- android - 每次连接后如何解决Android旋转BLE Mac地址的问题?
- java - 使用java 8按类型列表的对象属性对对象列表进行分组:JAVA
- python - Python concurrent.futures ProcessPoolExecutor 用于创建多个 .json 文件