|
|
@@ -5,11 +5,13 @@
|
|
5
|
5
|
|
|
6
|
6
|
package org.jitsi.meet.sdk;
|
|
7
|
7
|
|
|
|
8
|
+import android.content.ActivityNotFoundException;
|
|
8
|
9
|
import android.content.Context;
|
|
9
|
10
|
import android.content.Intent;
|
|
10
|
11
|
import android.net.Uri;
|
|
11
|
12
|
import android.provider.Settings;
|
|
12
|
13
|
|
|
|
14
|
+import com.facebook.react.bridge.Promise;
|
|
13
|
15
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
14
|
16
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
15
|
17
|
import com.facebook.react.bridge.ReactMethod;
|
|
|
@@ -25,7 +27,7 @@ class AndroidSettingsModule extends ReactContextBaseJavaModule {
|
|
25
|
27
|
}
|
|
26
|
28
|
|
|
27
|
29
|
@ReactMethod
|
|
28
|
|
- public void open() {
|
|
|
30
|
+ public void open(Promise promise) {
|
|
29
|
31
|
Context context = getReactApplicationContext();
|
|
30
|
32
|
Intent intent = new Intent();
|
|
31
|
33
|
|
|
|
@@ -34,6 +36,15 @@ class AndroidSettingsModule extends ReactContextBaseJavaModule {
|
|
34
|
36
|
intent.setData(
|
|
35
|
37
|
Uri.fromParts("package", context.getPackageName(), null));
|
|
36
|
38
|
|
|
37
|
|
- context.startActivity(intent);
|
|
|
39
|
+ try {
|
|
|
40
|
+ context.startActivity(intent);
|
|
|
41
|
+ } catch (ActivityNotFoundException e) {
|
|
|
42
|
+ // Some devices may give an error here.
|
|
|
43
|
+ // https://developer.android.com/reference/android/provider/Settings.html#ACTION_APPLICATION_DETAILS_SETTINGS
|
|
|
44
|
+ promise.reject(e);
|
|
|
45
|
+ return;
|
|
|
46
|
+ }
|
|
|
47
|
+
|
|
|
48
|
+ promise.resolve(null);
|
|
38
|
49
|
}
|
|
39
|
50
|
}
|