Skip to content

Commit e181bcf

Browse files
EddyVerbruggen#55 EddyVerbruggen#2 Less aggressive cleanup of the intent
1 parent 4a60653 commit e181bcf

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

src/android/nl/xservices/plugins/LaunchMyApp.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
3939
public void onNewIntent(Intent intent) {
4040
final String intentString = intent.getDataString();
4141
if (intentString != null && intentString.contains("://")) {
42+
intent.setData(null);
4243
try {
4344
StringWriter writer = new StringWriter(intentString.length() * 2);
4445
escapeJavaStyleString(writer, intentString, true, false);

www/android/LaunchMyApp.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
(function () {
22
"use strict";
3-
4-
function triggerOpenURL() {
5-
cordova.exec(
6-
(typeof handleOpenURL == "function" ? handleOpenURL : null),
7-
null,
8-
"LaunchMyApp",
9-
"checkIntent",
10-
[]);
3+
4+
var remainingAttempts = 10;
5+
6+
function waitForAndCallHandlerFunction(url) {
7+
if (typeof window.handleOpenURL == "function") {
8+
window.handleOpenURL(url);
9+
} else if (remainingAttempts-- > 0) {
10+
setTimeout(function(){waitForAndCallHandlerFunction(url)}, 500);
1111
}
12+
}
13+
14+
function triggerOpenURL() {
15+
cordova.exec(
16+
waitForAndCallHandlerFunction,
17+
null,
18+
"LaunchMyApp",
19+
"checkIntent",
20+
[]);
21+
}
1222

1323
document.addEventListener("deviceready", triggerOpenURL, false);
1424
}());

0 commit comments

Comments
 (0)