GithubHelp home page GithubHelp logo

Comments (34)

nikDemyankov avatar nikDemyankov commented on June 27, 2024 1

@mikeduarte thanks )

Well, if https://www.mydomain.com/sale-products/shirts is opened from other sources and events are fired - then we can be sure, that plugin works as it should :) That's good.

I think the problem you are facing is more like the feature from the Apple. How universal links works: when user clicks on the link - safari checks, if any of the installed apps can handle it; if app is found - safari starts it, if not - link opened as usual inside safari. I think, that when user already browsing your website - whatever link he presses - he is not gonna live the web. And I think that's fine: if I am browsing some website - I don't want to leave it until I decide so.

Just tested that theory with the Twitter. If I open https://mobile.twitter.com in Safari and then press on Log in button - it opens on safari (https://mobile.twitter.com/session/new). And I can see the banner on the top of the screen. But if I email that link to me and then click on it from the email (https://mobile.twitter.com/session/new) - application is launched.

So this is a feature, not a bug ) I should probably add that in the readme...

Another thing that every developer should be aware of:
When a user is in an app opened by Universal Links - a return to browser option will persist at the top of the screen (i.e. foobar.com). Users who have clicked the foobar.com option will be taken to their Safari browser, and Apple Banner is persistently rendered on the top of the window. This banner has an OPEN call to action. For all future clicks of URLs associated with this app via Universal Links, the app will never be launched again for the user, and the user will continue being redirected to the Safari page with the banner. If the user clicks OPEN - then the app will be launched, and all future clicks of the URL will deep linking the user to the app.

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

Hi. No, that should not be happening. Application must launch directly.

Did you configure smart-banner for your website?

Also, what link are you opening, and what is the content of the apple-app-site-association file?

from cordova-universal-links-plugin.

rispig avatar rispig commented on June 27, 2024

@nikDemyankov Yes, smart-banner is active.
I'm using path: [*] in the association file.

The weird thing is when I use Apple's validation tool I get a empty recommended value for my universal link , instead of passed (it does however show that it found the association fils in the extracted data column)

Also weird is that if I click the open in app banner it opens the app as if it was open from a universal link, and this banner is not removable.

Also, under the smart banner it show a recommended action:
"Could not extract required information for deep links. Learn how to include Smart App Banners, Twitter Cards or Facebook App Links."

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

@rispig Try to do this:

  1. In your project's root folder go to platforms/ios and open *.xcodeproj file with the Xcode (instead of * there will be the name of your project).
  2. In the file navigator (left side in Xcode) select your project name. It should be the first file in the list.
  3. Select Capabilities and scroll down to the Associated Domains.
  4. Check, that your domain is listed there as applinks:yourdomain.com.
  5. Check, that there is no errors (red cross) in the Steps section of the Associated Domains. It should look like that:
    v Add the "Associated Domains" entitlement to your entitlements file v Add the "Associated Domains" entitlements to your App ID

If everything is fine - then turn it off and then on. It might reset list of domains. In that case - add them manually:

  1. Press on the + in the Associated Domains.
  2. Enter: applinks:yourdomain.com. Change yourdomain.com with... your domain :)

from cordova-universal-links-plugin.

rispig avatar rispig commented on June 27, 2024

img_5708
@nikDemyankov thanks, didn't work
if I remove the applinks from the entitlements my site no longer shows the banner 'open in app'
when add it back and re-compile the site does show the banner, but the app is not opened by itself

and as I said when I click the banner the plugin's functions are called as if it a universal link

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

Hmm, that is strange. Ok, let's try another approach.

Let's try to change the format of the apple-app-site-association.

  1. Open your apple-app-site-association file. It should be something like this:

    {
      "applinks": {
        "apps": [],
        "details": [
          {
            "appID": "<YOUR_TEAM_ID>.<YOUR_BUNDLE_ID>",
            "paths": [
              "*"
            ]
          }
        ]
      }
    }
  2. Change it to:

    {
      "applinks": {
        "apps": [],
        "details": {
          "<YOUR_TEAM_ID>.<YOUR_BUNDLE_ID>": {
            "paths": [
              "*"
            ]
          }
        }
      }
    }
  3. Sign it with SSL certificate and upload on the server.

  4. Reinstall the app, launch it once, close and try to open your web link.

If that doesn't help, another thing to try is as described in here in Configure your file server section:

Alright! So you have your signed apple-app-site-association file. Now you just need to configure your file server to host this for you. There are a few caveats:

  1. It must be sent with the header application/pkcs7-mime
  2. It must be sent from the endpoint youdomain.com/apple-app-site-association
  3. It must return a 200 http code.

We setup the one for all Branch integrated apps using our Node+Express link servers. Hereโ€™s the code we used in case thatโ€™s helpful:

var aasa = fs.readFileSync(__dirname + '/static/apple-app-site-association');
app.get('/apple-app-site-association', function(req, res, next) {
     res.set('Content-Type', 'application/pkcs7-mime');
     res.status(200).send(aasa);
});

from cordova-universal-links-plugin.

rispig avatar rispig commented on June 27, 2024

@nikDemyankov Changing the association file fails the apple validator and I get a message saying it doesn't find the paths value.

if I add app-argument to my smart-banner meta tag content it seems that validation for smart-banner and the universal link are passing, however, I'm still getting the same open in app banner instead of seamless opening

update: I just noticed that my server serves the file as application/octet-stream and not pkcs7-mime
will check the issue and update

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

Provided format of the apple-app-site-association file is the old one and should be valid, but ok.

Regarding validator: yes, if you test bnc.lt in the Apple validation tool and compare the result to your domain - you will see, that it's basically the same. Difference only in the Smart Banner section: you have it and they don't. Plus, they are using the old format of the apple-app-site-association file, but this should not be the problem.

Try to modify your web server as I described in the previous post: with http 200 and application/pkcs7-mime.

Also, since in paths you have set * - then try to open some non-existing link. For example:

  1. Send yourself an email with the link: https://group.market/testpage.html. It doesn't exist, and this is fine.
  2. Open that email on your mobile device and click on the link.

What will happen?

from cordova-universal-links-plugin.

rispig avatar rispig commented on June 27, 2024

@nikDemyankov
apparently it was working the entire time
the only this is if I try to access the root domain i.e https://group.market it opens safari with the banner
if I try to access https://group.market/<any value> it will open the app
what am I missing?

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

Good question... Can you show me your universal-links section from the config.xml file?

from cordova-universal-links-plugin.

rispig avatar rispig commented on June 27, 2024

@nikDemyankov

<universal-links>
    <host name="group.market" scheme="https" event="universalLink" />
</universal-links>

And while we're at it - any idea why the js events are not called on cold start? (it only opens the app, but doesn't go through the event)

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

config.xml seems to be correct. Don't know yet why it opens browser instead of the app. Maybe because of the smart-banner. The way to test it is:

  1. Create a test page: https://group.market/testpage.html . Any content, or even empty.
  2. Try to open it as Universal Link: from email, or any other place. Just to check, that application is launched instead of the browser.
  3. Add smart-banner on the page and try to open the link again. What will be launched?

Regarding JS question:
If you launch the application first from the app icon, close it (by pressing home button on the phone) and then click on the link - JS event is captured? But if you kill the app from task manager, and then click on the link - event is missed?

from cordova-universal-links-plugin.

rispig avatar rispig commented on June 27, 2024

I have the smart banner in all of the pages (I serve them with the meta tag from my server)
It doesn't have to be anything, all I need to do is go to https://group.market/<random> and it opens my app.

regarding the JS, yes.
If I kill the app and click on a universal link the app does open, but the universal link event isn't called and my navigation doesn't happen (it acts as if the user clicked the icon on his homepage)

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

Just wanted to test with the real page, that is not an index one and has a smart-banner on it. Don't now what is the problem, I'll keep googling, maybe something will come up.

Regarding JS: I'll investigate that. Are you subscribing to the event like so in your index.js:

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

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

  // deviceready Event Handler
  onDeviceReady: function() {
    console.log('Handle deviceready event if needed.');
  },

  // openNewsListPage Event Handler
  onUniversalLinksEvent: function(event) {
    console.log('Launched from UL.');
  }
};

app.initialize();

from cordova-universal-links-plugin.

rispig avatar rispig commented on June 27, 2024

yup ^
exactly like that.

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

Understood, thanks for the that. Created new issue for event dispatching - #3

from cordova-universal-links-plugin.

rispig avatar rispig commented on June 27, 2024

@nikDemyankov
Your plugin is doing wonders for us. thank you for all the help!

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

@rispig happy to help :) Thank you for using it and providing feedback! Sorry, that it has some issues, but will continue to work on them.

from cordova-universal-links-plugin.

mikeduarte avatar mikeduarte commented on June 27, 2024

@nikDemyankov
Your plugin is great, but I too am having some problems.

The universal links work perfectly from links by email or other domains like google.com. For example, if I search for a page on my site from google, and then click a link google provides to my page, the app launches and the events fire. However, if I am on a page on my site and click a link that should open the app, it doesn't open the app.

Example:

if I am on this page:
https://www.mydomain.com

and click on a link to this page:
https://www.mydomain.com/sale-products/shirts

the app won't open and I see a banner at top of page like @rispig sees in safari. If I then click on the banner, the app opens with the proper events firing

If I go to google.com and click on the same exact "shirts" link as above like so:
https://www.mydomain.com/sale-products/shirts
the app opens and fires the proper events

My paths in association file looks like this:
paths : ["/sale-products/*"]

my config file has:

    <universal-links>
        <host name="www.mydomain.com" scheme="https">
            <path url="/sale-products/*" event="handleDeepLink" />
        </host>
    </universal-links>

So app always opens when clicking on a link from another domain, but from a link on the same domain, I have issues.

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

And maybe this is also your case @rispig

from cordova-universal-links-plugin.

mikeduarte avatar mikeduarte commented on June 27, 2024

@nikDemyankov Thank you for the explanation. After writing my post and thinking about the way things were working, I started to come to the conclusion that this is exactly how Apple wants Universal Links to work. If you are in another app or on a search engine and you click on a universal link, iOS opens the app. If you are already on a domain in Safari that has universal links, prompt the user with a banner instead of launching the app.

Thanks again for this great plugin - works really well.

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

Thanks @mikeduarte :)

from cordova-universal-links-plugin.

H0rst avatar H0rst commented on June 27, 2024

@nikDemyankov: I have troubles with iOS, too.
I have done all steps and double checked it for 3 days, but i don't get the links to work. So i have some questions:

  1. I found that the apple-app-site-association file can be unsigned with iOS9, when the server runs https and the mime type is json. Is this right?
  2. My Team ID and the App Prefix are not the same. In your documentation it looks, like it should so. I have tried both and also Developer and Distribution ID. I had no success. But the Team ID is the right one? Yes?
  3. I have checked with the apple tool. I get a "passed" at Deep Links and Universal Links. Can i be sure that this part is OK?
  4. I have added the Capabilities and my URL is shown correct. I have 2 checkmarks at Steps. When i run the app in XCode on a device, should it work? I have a link in an email, but it always open in Safari. I see a Smart Banner, but it takes me only to the app store.
    One thing is special: When i open safari and then run the app in xcode, my app gets a "Back to Safari" at the top of the screen.
    Is this a ways i can test it? Or has the app to be published at the store, before i see a result?

best regards
Horst

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

@H0rst:

Or has the app to be published at the store, before i see a result?

No, you don't need to publish the app to be able to test it. It should work as it is.

One thing is special: When i open safari and then run the app in xcode, my app gets a "Back to Safari" at the top of the screen.

That's a normal behaviour, it doesn't depend on Universal Links. If I create an empty Cordova app, launch emulator, open Safari in it, then run the app from the Xcode - I'll get the same "Back to Safari" button.

1. I found that the apple-app-site-association file can be unsigned with iOS9, when the server runs https and the mime type is json. Is this right?

Hmm, yes, haven't notice that before, but according to the Apple documentation that should be true:

If your app runs in iOS 9 or later and you use HTTPS to serve the apple-app-site-association file, you can create a plain text file that uses the application/json MIME type and you donโ€™t need to sign it.

But only for iOS 9 apps, that are using Universal Links. If you are using apple-app-site-association file for other features - then you need to sign it. But that's not your case, as I understand.

2. My Team ID and the App Prefix are not the same. In your documentation it looks, like it should so. I have tried both and also Developer and Distribution ID. I had no success. But the Team ID is the right one? Yes?

From the Apples documentation about apple-app-site-assosiation file:

Each app-specific dictionary contains an appID key and a paths key. The value of the appID key is the appโ€™s team ID and the bundle ID;

So, probably, you should use team ID. And also, look into this documentation regarding having multiple App ID prefixes. Maybe you need to try to migrate to the single one.

3. I have checked with the apple tool. I get a "passed" at Deep Links and Universal Links. Can i be sure that this part is OK?

Did you use App Search Validation Tool? As I understand, it only checks apple-app-site-association file existents and validates it format. Maybe, checks app preferences in Member Centre, but not sure about that. Either way, it doesn't guaranty, that UL will work, since it consist of two sides: web and app.

4. I have added the Capabilities and my URL is shown correct. I have 2 checkmarks at Steps. When i run the app in XCode on a device, should it work? I have a link in an email, but it always open in Safari. I see a Smart Banner, but it takes me only to the app store.

It should. Maybe there is something wrong the URL you are trying to open? Try to set up some explicit one, for example: https://mydomain.com/test. It doesn't have to exist on your server: it just should be set in the apple-app-site-association file and in application Entitlements. If you are using plugin - then set it in config.xml:

<universal-links>
  <host name="mydomain.com" scheme="https">
     <path url="/test" />
  </host>
</universal-links>

And execute cordova build, then cordova run --device. Then send this link to your email and try to open it.

Another way to check, if URL can be handled by the app is a bit hacky, but still:

  1. Open iOS project in Xcode.
  2. Open Plugins/CULPlugin.m.
  3. Uncomment lines from 30 to 38.
  4. On line 35 set URL you are trying to open.
  5. Set a breakpoint on line 43.
  6. Launch the app on the emulator.
  7. Press Home button.
  8. In the emulator press on the application icon to resume it. This should trigger a breakpoint. See how it is executed: what does handleUserActivity method returns. It should be YES. If not - then plugin can't find a match between the link and the ones that you set in config.xml.

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

@H0rst you can also try to use branch.io service to test the UL as described in the plugins documentation. If it will work - then you have configured data in Member Centre properly. After that you'll have to configure app-site-assosiation-file on your server and change the links in config.xml to your own.

from cordova-universal-links-plugin.

H0rst avatar H0rst commented on June 27, 2024

@nikDemyankov: Thank you for the informations. The same app works on Android just fine (you remember, i had the timing problem). So config.xml should be OK.
I have tried to edit CULPlugin.m. It recognizes the URL and return yes. But nothing more happens. Iam not very familiar with XCode and iOS development.
In config.xml the event is ULOpen. In index.html i have
function onULOpen(event) {
alert('onULOpen')
}
and in onDeviceReady i do this:
universalLinks.subscribe('ULOpen', this.onULOpen);

As i understand it, if the app is not started, when a link is used, then it is no error at url recognization. It is a problem, that the url is not assigned to the app.

PS: Yes, i have tested with the App search validation tool. And i have also tried with signing the app-site-assosiation-file. When i use a non existing URL (with a path in config.cml) i get a 404 error in safari. I have double and trible checked all things and removed and reinstalled the plugin. But no success.

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

@H0rst

As i understand it, if the app is not started, when a link is used, then it is no error at url recognization. It is a problem, that the url is not assigned to the app.

Most likely. How Universal Links works on iOS (sort of):
When a user clicks on the link - Safari checks for apple-app-site-association file in https://linkdomain.com/apple-app-site-association. If it finds it - it reads appID from it and matches to the applications, that are installed on your device. Then it matches URL's in the paths of apple-app-site-association file. If it's ok - then application is launched. If something from above is wrong - link is opened in Safari.

Make sure, that your apple-app-site-association file is accessible directly: no redirects and it lies in the root of the domain, which link you are trying to open. Also, double check the application preferences in Member Centre.

If I'll come up with some other suggestions - I'll add them. But at the moment - don't know where the problem lies. Just a stupid thought, but still: make sure, that you are running the app on iOS 9 device, since UL is for iOS 9 and above :)

from cordova-universal-links-plugin.

H0rst avatar H0rst commented on June 27, 2024

@nikDemyankov thank you. i have checked all of this. And i have found this open issue at the apple forum: https://forums.developer.apple.com/thread/20592
So maybe my old prefix is the reason. I have contacted Apple to set it to my Team Id.
I am 100% sure the app-site-association file is correct (no redirect, correct mime type and all the other stuff). And yes, i use a iOS 9 device for testing ;-)

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

@H0rst hope it will work for you. Because it seems that this is the only thing left in there. As a test you can create a totally new app. In the Member Centre -> Identifiers -> App ID register a new one and select as a prefix Team ID. Then configure everything else, as described in the docs and check if UL will work.

And yes, i use a iOS 9 device for testing ;-)

That's why I said, that it is stupid thought :)

from cordova-universal-links-plugin.

H0rst avatar H0rst commented on June 27, 2024

@nikDemyankov While waiting for the change, i updated Android to version 1.1. But it won't work. I changed the subscription to the new version. When i click on a link the device let me open it in my app. but the universal link event is not executed. I have tried
universalLinks.subscribe(null, function(){alert('alive')});
at onDeviceReady and at the start of index.html. But no success. The old 1.0 version of the plugin has worked, when i put the events addEventListener at the beginning of index.html.

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

@H0rst can you, please, create a separate issue for that, since current one is huge already and will close it eventually :) we can continue discussion regarding Android in there.

from cordova-universal-links-plugin.

H0rst avatar H0rst commented on June 27, 2024

@nikDemyankov just for your Information: I had changed my App ID to have my Team ID as Prefix (i has taken some time, because i have to contact apple developer support for this). It has not worked. But i have left the code in the app and submited it to the app store. Today i have released this version. And after installing the update from the app store, universal links are working. \o/

from cordova-universal-links-plugin.

nikDemyankov avatar nikDemyankov commented on June 27, 2024

@H0rst Thanks for the info, glad to hear that :) Although, it is really strange, that UL didn't work until the actual release even after changing AppID to TeamID. But glad that it worked out :)

from cordova-universal-links-plugin.

nordnet-deprecation-bot avatar nordnet-deprecation-bot commented on June 27, 2024

๐Ÿ‘‹ 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.

from cordova-universal-links-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.