protected Intent[] getIntentsToViewFile(Intent intent, Uri uri) { PackageManager pm = this.reactContext.getPackageManager(); List<ResolveInfo> resInfo = pm.queryIntentActivities(intent, 0); Intent[] extraIntents = new Intent[resInfo.size()]; for (int i = 0; i < resInfo.size(); i++) { ResolveInfo ri = resInfo.get(i); String packageName = ri.activityInfo.packageName; Intent newIntent = new Intent(); newIntent.setComponent(new ComponentName(packageName, ri.activityInfo.name)); newIntent.setAction(Intent.ACTION_VIEW); newIntent.setDataAndType(uri, intent.getType()); newIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); extraIntents[i] = new Intent(newIntent); } return extraIntents; } protected void openIntentChooser() throws ActivityNotFoundException {
private boolean isCallable(Intent intent) { List<ResolveInfo> list = getReactApplicationContext().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; }
private boolean isSensorAvailable() { if (ActivityCompat.checkSelfPermission(mReactContext, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) { return false; } return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && (mReactContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) || ((FingerprintManager) mReactContext.getSystemService(Context.FINGERPRINT_SERVICE)).isHardwareDetected()); }
@ReactMethod public void isSensorAvailable(final Promise promise) { response = Arguments.createMap(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ActivityCompat.checkSelfPermission(mReactContext, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) { sendResponse("failed", "You haven't allow this app to use your fingerprint sensor", promise); return; } if (mReactContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) || ((FingerprintManager) mReactContext.getSystemService(Context.FINGERPRINT_SERVICE)).isHardwareDetected()) { if (((FingerprintManager) mReactContext.getSystemService(Context.FINGERPRINT_SERVICE)).hasEnrolledFingerprints()) { sendResponse("ok", null, promise); } else { sendResponse("failed", "You have fingerprint sensor, but you should set it enabled in your settings to use with this app", promise); } } else { sendResponse("failed", "You don\'t have appropriate hardware", promise); } } else { sendResponse("failed", "You don\'t have appropriate hardware", promise); } }