(location: string)
| 61 | } |
| 62 | |
| 63 | export function openUrl(location: string): boolean { |
| 64 | const context = androidUtils.getApplicationContext(); |
| 65 | try { |
| 66 | const intent = new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(location.trim())); |
| 67 | intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); |
| 68 | context.startActivity(intent); |
| 69 | } catch (e) { |
| 70 | // We don't do anything with an error. We just output it |
| 71 | Trace.write(`Failed to start activity for handling URL: ${location}`, Trace.categories.Error, Trace.messageType.error); |
| 72 | |
| 73 | return false; |
| 74 | } |
| 75 | |
| 76 | return true; |
| 77 | } |
| 78 | |
| 79 | export function openUrlAsync(location: string): Promise<boolean> { |
| 80 | return new Promise<boolean>((resolve, reject) => { |
nothing calls this directly
no test coverage detected