Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Commit 0d50701

Browse files
committed
fix(android-error): Solve android error
see #16
1 parent bf72ff3 commit 0d50701

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
"node_modules",
2121
"bundles"
2222
]
23-
}
23+
}

urlhandler.android.ts

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let lastReceivedData = null;
77

88
export function handleIntent(intent: any) {
99
let data = intent.getData();
10-
if (data !== lastReceivedData) {
10+
if (data.toString() !== lastReceivedData.toString()) {
1111
try {
1212
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
1313
application.android.on(application.AndroidApplication.activityResultEvent, (eventData) => {
@@ -22,29 +22,24 @@ export function handleIntent(intent: any) {
2222
}
2323
}
2424
application.android.on(application.AndroidApplication.activityCreatedEvent, (args) => {
25-
let intent: android.content.Intent = args.activity.getIntent(),
26-
data = intent.getData();
27-
if (data !== lastReceivedData) {
28-
try {
29-
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
30-
handleIntent(intent);
31-
}
32-
} catch (e) {
33-
console.error('Unknown error during getting App URL data', e);
25+
let intent: android.content.Intent = args.activity.getIntent();
26+
try {
27+
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
28+
handleIntent(intent);
3429
}
30+
} catch (e) {
31+
console.error('Unknown error during getting App URL data', e);
3532
}
33+
3634
});
3735
application.android.on(application.AndroidApplication.activityResumedEvent, (args) => {
38-
let intent: android.content.Intent = args.activity.getIntent(),
39-
data = intent.getData();
40-
if (data !== lastReceivedData) {
41-
try {
42-
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
43-
handleIntent(intent);
44-
lastReceivedData = data;
45-
}
46-
} catch (e) {
47-
console.error('Unknown error during getting App URL data', e);
36+
let intent: android.content.Intent = args.activity.getIntent();
37+
try {
38+
if (new String(intent.getAction()).valueOf() === new String(android.content.Intent.ACTION_VIEW).valueOf()) {
39+
handleIntent(intent);
40+
lastReceivedData = intent.getData();
4841
}
42+
} catch (e) {
43+
console.error('Unknown error during getting App URL data', e);
4944
}
5045
});

0 commit comments

Comments
 (0)