I would like to open my android application from a link in an email. Searching through Stackoverflow it looks like this can be achieved using a '' which points to a url I control. I'm a little confused how to use this though in the case of an android app built with Nativescript. Is just adding a url that I own with a specific data path the only thing that needs to be done? In which case that brings up an app selector dialog. Can a certain event be fired off when the application is opened this way? Thanks for the help. Below is a sample of what it looks like I need to do.
<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>
NativeScript is a free and open-source framework for developing mobile applications. It is used to build truly native mobile apps using JavaScript. You can easily develop a native UI and higher-performance apps for your iOS and Android platforms using Angular skills.
To edit the Package Name and the Application Id, modify the package. json of your app and set the nativescript.id key. You may need to delete platforms/android and rebuild using the CLI command ns prepare android . Read more about "ApplicationId versus PackageName".
Add this to you 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());
}
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With