Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从电子邮件中的链接打开Nativescript Android应用程序_Javascript_Android_Nativescript - Fatal编程技术网

Javascript 从电子邮件中的链接打开Nativescript Android应用程序

Javascript 从电子邮件中的链接打开Nativescript Android应用程序,javascript,android,nativescript,Javascript,Android,Nativescript,我想通过电子邮件中的链接打开我的android应用程序。通过Stackoverflow进行搜索看起来这可以通过使用指向url I控件的“”来实现。我有点困惑如何在使用Nativescript构建的android应用程序中使用它。仅仅添加一个我拥有的带有特定数据路径的url是唯一需要做的事情吗?在这种情况下,会弹出一个应用程序选择器对话框。当应用程序以这种方式打开时,是否可以触发某个事件?谢谢你的帮助。下面是我需要做的一个示例 <intent-filter> &

我想通过电子邮件中的链接打开我的android应用程序。通过Stackoverflow进行搜索看起来这可以通过使用指向url I控件的“”来实现。我有点困惑如何在使用Nativescript构建的android应用程序中使用它。仅仅添加一个我拥有的带有特定数据路径的url是唯一需要做的事情吗?在这种情况下,会弹出一个应用程序选择器对话框。当应用程序以这种方式打开时,是否可以触发某个事件?谢谢你的帮助。下面是我需要做的一个示例

    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER" />

        <!-- Custom Path data -->
        <data
            android:host="www.some.company.com"
            android:path="/something"
            android:scheme="http"/>
    </intent-filter>

将此添加到您的
main.ts

import app = require("application");
import platform = require("platform");

declare var android: any;

if(!!app.android){
    app.android.on(app.AndroidApplication.activityResumedEvent, function (args) { 
        console.log("Event: " + args.eventName + ", Activity: " + args.activity); 
        console.log(new String(args.activity.getIntent().getAction()).valueOf(), new String(android.content.Intent.ACTION_VIEW).valueOf());
        if(new String(args.activity.getIntent().getAction()).valueOf() ==  new String(android.content.Intent.ACTION_VIEW).valueOf()){
            console.log(args.activity.getIntent().getData()); 
        }
    });
}