javascript - App-link 将打开应用程序但会调用回调
问题描述
我正在使用 Angular Nativescript 构建一个 android 应用程序。我希望应用程序能够通过链接打开。我在我的 AndroidManifest.xml 中添加了这个:
<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="https"
android:host="www.myApp.com"
android:pathPrefix="/springView"/>
</intent-filter>
在我的 app.comonent.ts 中:
import { Component, NgZone, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { registerUniversalLinkCallback } from "@nativescript-community/universal-links";
@Component({
selector: "ns-app",
templateUrl: "./app.component.html"
})
export class AppComponent implements OnInit {
constructor(private router: Router,
private zone: NgZone) { }
ngOnInit() {
registerUniversalLinkCallback(url => {
this.zone.run(() => {
alert("Got here!");
})
})
}
}
当应用程序在后台并且我单击链接时,它会转到那里,但是如果应用程序关闭,链接会打开它,但不会转到回调函数
解决方案
推荐阅读
- c# - 只执行一次计划任务
- sql - SQL Server Query for average value over a date period
- android - 如何在 recyclerView 或 Logcat 上获取此 Firebase 存储中的所有图像?
- spring-cloud-dataflow - Why task launcher prunes the task instance history every time a new task instance is launched?
- amazon-web-services - Has anyone built an integration with any SMS Receivers?
- python - 使用tensorflow时在哪里可以找到ssd_mobilenet_v1_coco的标签映射文件(pbtxt)?
- c - C中算术表达式中的空格
- sql - Django 原始 SQL 查询 - 遍历 args,然后在查询中使用它
- python - 如何使用 python 将数据正确插入 MySQLdb?
- java - 加载相应的 jar 文件 (VLCJ) 后 JAVA 导入不起作用