Comments (8)
Maybe Cordova didn't actually update the plugin? Try to run:
cordova clean
cordova prepare
cordova build
Or reinstall the plugin.
Just created a new app:
cordova create TestApp
cd TestApp
cordova platform add android
cordova plugin add cordova-universal-links-plugin
Then added the following to the config.xml:
<universal-links>
<host name="testapp.com">
<path url="/test/*" />
</host>
</universal-links>
And in index.js:
onDeviceReady: function() {
app.receivedEvent('deviceready');
universalLinks.subscribe(null, function() {
alert('Launched by event');
});
},
Then cordova run android
, close it and:
adb shell am start -W -a android.intent.action.VIEW -d "http://testapp.com/test/path" io.cordova.hellocordova
And I get the alert message.
from cordova-universal-links-plugin.
I can confirm, that it works with a new app. But not with the old one. I have removed the plugin and reinstalled it. I checked the files in platforms\android\src\com\nordnetab\cordova\ul
. They are all new.
from cordova-universal-links-plugin.
Can you share your <universal-links>
content from config.xml
? Or something similar to what you have in it.
from cordova-universal-links-plugin.
I have added some debugging code to UniversalLinksPlugin.java
:
private void tryToConsumeEvent() {
Log.d("UniversalLinks", "tryToConsumeEvent");
if (subscribers.size() == 0 || storedMessage == null) {
Log.d("UniversalLinks", "return");
return;
}
Log.d("UniversalLinks", "consume");
final String storedEventName = storedMessage.getEventName();
Log.d("UniversalLinks", "storedEventName "+storedEventName);
final Set<Map.Entry<String, CallbackContext>> subscribersSet = subscribers.entrySet();
for (Map.Entry<String, CallbackContext> subscriber : subscribersSet) {
final String eventName = subscriber.getKey();
Log.d("UniversalLinks", "eventName "+eventName);
if (eventName.equals(storedEventName)) {
Log.d("UniversalLinks", "sendMessageToJs");
sendMessageToJs(storedMessage, subscriber.getValue());
storedMessage = null;
break;
}
}
}
When i try i get this output:
01-15 14:03:51.001: D/UniversalLinks(28299): tryToConsumeEvent
01-15 14:03:51.001: D/UniversalLinks(28299): consume
01-15 14:03:51.001: D/UniversalLinks(28299): storedEventName ULOpen
01-15 14:03:51.001: D/UniversalLinks(28299): eventName didLaunchAppFromLink
In config.xml
i use
<universal-links>
<host name="www.blutdruckdaten.de" scheme="https">
<path event="ULOpen" url="/lexikon.html" />
<path event="ULOpen" url="/lexikon/*" />
<path event="ULOpen" url="/chk*" />
<path event="ULOpen" url="/del*" />
<path event="ULOpen" url="/news.html" />
<path event="ULOpen" url="/newsarchiv.html" />
<path event="ULOpen" url="/news-en.html" />
<path event="ULOpen" url="/newsarchive.html" />
</host>
</universal-links>
I have searched for didLaunchAppFromLink
in your code and found it as default string. I have tried to replace it wth ULOpen
, but i get the same result. I am not familiar with Java.
from cordova-universal-links-plugin.
I have replaced the text didLaunchAppFromLink
in all your code with ULOpen
. In this case it works.
from cordova-universal-links-plugin.
So, wait. If I understood correctly, you has a config.xml
:
<universal-links>
<host name="www.blutdruckdaten.de" scheme="https">
<path event="ULOpen" url="/lexikon.html" />
<path event="ULOpen" url="/lexikon/*" />
<path event="ULOpen" url="/chk*" />
<path event="ULOpen" url="/del*" />
<path event="ULOpen" url="/news.html" />
<path event="ULOpen" url="/newsarchiv.html" />
<path event="ULOpen" url="/news-en.html" />
<path event="ULOpen" url="/newsarchive.html" />
</host>
</universal-links>
Then in index.js
you are trying to do like so:
universalLinks.subscribe(null, function() {
alert('alive')
});
If so, then yes - that is not gonna work. If you have set event
to the <path />
component - then you need to provide this event name, when you subscribe:
universalLinks.subscribe('ULOpen', function() {
alert('alive')
});
from cordova-universal-links-plugin.
X-) I missunderstood event name null is catching all events. I tried my event name before, but with the iOS problem i changed it to be sure, there is no error at this. Sorry.
You can close the issue, it is working now.
from cordova-universal-links-plugin.
I missunderstood event name null is catching all events.
No, it captures all unnamed events :) Good that the problem is solved.
from cordova-universal-links-plugin.
Related Issues (20)
- web link problem in android HOT 1
- iOS ERROR ITMS-90046 Code Signing Entitlements not supported on iOS. value 'app links:*my_domain.com' for key 'com.apple.developer.associated-domains' HOT 3
- universalLinks.subscribe callback never firing - how to debug? HOT 1
- On resume From Background through link .. JS function dont get fired
- On resuming app through link .. JS event dont get fired HOT 1
- Add additional maintainers HOT 2
- Not receiving event on ios HOT 3
- Does universal link (ios) work with updates? HOT 1
- eventData contains at most 1 URL parameter HOT 3
- Anybody got this working with Ionic? HOT 1
- Edited: Cordova can't build with plugin installed and <host> specified. HOT 4
- Events fired in Android only locally HOT 2
- [Cordova] Can't use authentication engine from Firebase HOT 4
- Clicking the link from within the native messaging app does not open app on Android HOT 1
- Works until uploading to app store on iOS HOT 1
- (node:7428) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of null HOT 1
- Deeplink is not working with Ipaddress HOT 1
- CODE_SIGN_ENTITLEMENTS in XCode project not correctly
- change plugin package name in npm HOT 1
- PSA: Deprecation notice 2018-09-30 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-universal-links-plugin.