nordnet / cordova-universal-links-plugin

[DEPRECATED] - Cordova plugin to support Universal/Deep Links for iOS/Android.
https://github.com/nordnet/cordova-universal-links-plugin/issues/160
MIT License
349 stars 529 forks source link

[ask] How to works? #75

Closed fahmi182 closed 5 years ago

fahmi182 commented 8 years ago

Hi, i try this plugin to app indexing,

my website structure is, example:

homepage: https://www.example.com article page: https://www.example.com/articles/example-slug.html

my apps structure is, example:

homepage: /index.html article page: /detail.html?id=12345

how to connect that with this plugin? sorry i'm noob please help :) Appreciate!

nikDemyankov commented 8 years ago

Hi,

Please, read the readme file of this plugin.

In short, at first you need to set preferences in your application's config.xml:

<universal-links>
    <host name="www.example.com" scheme="https">
        <path url="/" event="onRootPage" />
        <path url="/articles/*" event="onArticlePage" />
    </host>
</universal-links>

Then in JS code:

var app = {
  // Application Constructor
  initialize: function() {
    this.bindEvents();
  },

  // Bind Event Listeners
  bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
  },

  // deviceready Event Handler
  onDeviceReady: function() {
    console.log('Device is ready for work');
    universalLinks.subscribe('onRootPage', app.onRootPage);
    universalLinks.subscribe('onArticlePage', app.onArticlePage);
  },

  onArticlePage: function(eventData) {
    console.log('Redirected from articles folder.');
  },

  onRootPage: function(eventData) {
    console.log('Redirected from root page');
  }
};

app.initialize();

Also, you need to setup your website as described here for Android and here for iOS.

nikDemyankov commented 7 years ago

@Prasanna-Repo Does it work, if you use other browser? Or click on the link from the email/some messenger?

Also, you use adb tool locally as described in the docs - app is launched?

nikDemyankov commented 7 years ago

@Prasanna-Repo it should work from chrome browser. But I am more concerned, that it's not opening from the mail. If adb test is passed - then the configuration is correct and app can handle the link properly. If you click on the link in the mail on the real device - it, probably, should ask you what application to use for the clicked link: some browser, or your app. If that is not happening - maybe you already clicked open link in browser and set this as a default action? That might be the problem.

Try to go to Settings->Apps->Configure app and reset default app for browser and opening links.

Also, try to create a new clean test app, configured to work with some fake domain (i.e. http://my.test.domain.com). Just build it, verify, that it is launched with adb properly. And then check again via email link. You don't need to configure anything on the server side or google play developer console.

nikDemyankov commented 7 years ago

Sorry for the late reply...

So, if I understood correctly - UL works, if you click on the link in email, and event is dispatched properly. But when you click on the link in the Chrome browser - user remain in it.

If email works - then your app has a correct setup. If you don't see app chooser when clicking on the link in mail - then, probably, website is also configured properly.

But if Chrome is holding user inside of it's context - I don't think you can change that. It's like with iOS: in some apps and browser it works, in some - it's not (https://blog.branch.io/ios-9.2-deep-linking-guide-transitioning-to-universal-links). Have you tried other browsers?

nikDemyankov commented 7 years ago

Hi @Prasanna-Repo,

No, UL plugin doesn't have app indexing feature. It should be a separate plugin for that.

nikDemyankov commented 7 years ago

Hi @Prasanna-Repo ,

This url is not for testing. It just should be set in your html on the web site, as stated in the official documentation.

For testing you should use url, that is defined in config.xml.

nordnet-deprecation-bot commented 5 years ago

👋 Hi! Thank you for your interest in this repo.

đŸ˜ĸ We are not using nordnet/cordova-universal-links-plugin anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹī¸ Please see #160 for more information.