|
|
@ -5,11 +5,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.jitsi.meet.sdk; |
|
|
|
package org.jitsi.meet.sdk; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.ActivityNotFoundException; |
|
|
|
import android.content.Context; |
|
|
|
import android.content.Context; |
|
|
|
import android.content.Intent; |
|
|
|
import android.content.Intent; |
|
|
|
import android.net.Uri; |
|
|
|
import android.net.Uri; |
|
|
|
import android.provider.Settings; |
|
|
|
import android.provider.Settings; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.facebook.react.bridge.Promise; |
|
|
|
import com.facebook.react.bridge.ReactApplicationContext; |
|
|
|
import com.facebook.react.bridge.ReactApplicationContext; |
|
|
|
import com.facebook.react.bridge.ReactContextBaseJavaModule; |
|
|
|
import com.facebook.react.bridge.ReactContextBaseJavaModule; |
|
|
|
import com.facebook.react.bridge.ReactMethod; |
|
|
|
import com.facebook.react.bridge.ReactMethod; |
|
|
@ -25,7 +27,7 @@ class AndroidSettingsModule extends ReactContextBaseJavaModule { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ReactMethod |
|
|
|
@ReactMethod |
|
|
|
public void open() { |
|
|
|
public void open(Promise promise) { |
|
|
|
Context context = getReactApplicationContext(); |
|
|
|
Context context = getReactApplicationContext(); |
|
|
|
Intent intent = new Intent(); |
|
|
|
Intent intent = new Intent(); |
|
|
|
|
|
|
|
|
|
|
@ -34,6 +36,15 @@ class AndroidSettingsModule extends ReactContextBaseJavaModule { |
|
|
|
intent.setData( |
|
|
|
intent.setData( |
|
|
|
Uri.fromParts("package", context.getPackageName(), null)); |
|
|
|
Uri.fromParts("package", context.getPackageName(), null)); |
|
|
|
|
|
|
|
|
|
|
|
context.startActivity(intent); |
|
|
|
try { |
|
|
|
|
|
|
|
context.startActivity(intent); |
|
|
|
|
|
|
|
} catch (ActivityNotFoundException e) { |
|
|
|
|
|
|
|
// Some devices may give an error here.
|
|
|
|
|
|
|
|
// https://developer.android.com/reference/android/provider/Settings.html#ACTION_APPLICATION_DETAILS_SETTINGS
|
|
|
|
|
|
|
|
promise.reject(e); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
promise.resolve(null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|