request camera permissions from webview #3003
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
efb8c3cdf2
commit
aa02547815
|
@ -6,7 +6,9 @@ import android.app.ActivityManager;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Looper;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.util.Log;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -19,7 +21,10 @@ import com.testfairy.TestFairy;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
public class MainActivity extends ReactActivity {
|
||||
public class MainActivity extends ReactActivity
|
||||
implements ActivityCompat.OnRequestPermissionsResultCallback{
|
||||
|
||||
private static final int PERMISSION_REQUEST_CAMERA = 0;
|
||||
|
||||
private static void registerUncaughtExceptionHandler(final Context context) {
|
||||
final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
|
@ -170,4 +175,12 @@ public class MainActivity extends ReactActivity {
|
|||
editor.putBoolean(REJECTED_ROOTED_NOTIFICATION, true);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// Permission has been granted. Start camera preview Activity.
|
||||
com.github.alinz.reactnativewebviewbridge.WebViewBridgeManager.grantAccess(requestCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -71,7 +71,7 @@
|
|||
"react-native-tcp": "3.3.0",
|
||||
"react-native-udp": "2.2.1",
|
||||
"react-native-vector-icons": "4.4.2",
|
||||
"react-native-webview-bridge": "github:status-im/react-native-webview-bridge#react-native-0.49",
|
||||
"react-native-webview-bridge": "github:status-im/react-native-webview-bridge#feature/camera-permissions",
|
||||
"readable-stream": "1.1.14",
|
||||
"realm": "2.0.7",
|
||||
"stream-browserify": "1.0.0",
|
||||
|
|
Loading…
Reference in New Issue