(location: string)
| 77 | } |
| 78 | |
| 79 | export function openUrlAsync(location: string): Promise<boolean> { |
| 80 | return new Promise<boolean>((resolve, reject) => { |
| 81 | try { |
| 82 | const context = androidUtils.getApplicationContext(); |
| 83 | const intent = new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(location.trim())); |
| 84 | intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); |
| 85 | context.startActivity(intent); |
| 86 | resolve(true); |
| 87 | } catch (e) { |
| 88 | // We don't do anything with an error. We just output it |
| 89 | Trace.write(`Failed to start activity for handling URL: ${location}`, Trace.categories.Error, Trace.messageType.error); |
| 90 | resolve(false); |
| 91 | } |
| 92 | }); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Check whether external storage is read only |
nothing calls this directly
no test coverage detected