Closed Tarun24RN closed 1 month ago
@Tarun24RN hello Thanks for the bug report !
I guess i didn't take into account Android 10 and below. i'll fix it and release it soon
Have a nice day
hello!
When you do addListener
(or useCaptureProtection
), the library asks for permission. However, if the user refuses, there is no listener failure handling, which leads to the following behaviour.
The recommended fix is as follows
Use CaptureProtection.requestPermission()
to get a permission request confirmation and use addListener
const register = await () => {
const permission = await CaptureProtection.requestPermission();
if (permission) {
CaptureProtection.addListener(~~~~);
} else {
ToastAndroid.show("permission is not granted");
}
}
Best Regards
Hi!
Thanks for replying.
I have implemented your code but it is not showing any popup or alert to user for asking permission instead await CaptureProtection.requestPermission() it return false. I have checked this in android 9
@Tarun24RN Hello, could you please forward me the AndroidManifest.xml
file and build.gradle
?
@Tarun24RN Hello, could you please forward me the
AndroidManifest.xml
file andbuild.gradle
?
@wn-na Which build.gradle and can you please tell me which part of code you need to check in manifest file i will attach that code.
@Tarun24RN I want to see the android/build.gradle
file.
@wn-na > @Tarun24RN I want to see the android/build.gradle
file.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 23 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "26.1.10909125" kotlinVersion = "1.9.22" buildTools: "30.0.3" excludeAppGlideModule = true
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
} repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath 'com.google.gms:google-services:4.3.14' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' // classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") classpath("com.facebook.react:react-native-gradle-plugin") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } }
//def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
This is the code of build.gradle
@Tarun24RN thanks. i will check it asap
@wn-na Also this is your library manifest in which I have commented out one permission.
@Tarun24RN hi, i fixed it and deployed to version 1.9.12, would you like to check it out?
@wn-na Yes, I will check it and update it here.
Fatal Exception: java.lang.SecurityException Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media/440622 from pid=2407, uid=10050 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
Above crash is showing on firebase in file com.captureprotection.CaptureProtectionModule$3.onChange (CaptureProtectionModule.java:56) for Android version below 10.