flutter-moum / flutter_screenshot_callback

Flutter plugin that allows you to detect mobile screenshot and execute callback functions on iOS and Android. 🚀
MIT License
104 stars 145 forks source link

Screenshot detect doesnot work on android #89

Open Mr-Talha110 opened 6 months ago

rehamalraee24 commented 5 months ago

did you figure out the issue?

Mr-Talha110 commented 5 months ago

not yet it works perfectly on ios but not android.

Project112224 commented 5 months ago

android 13 Permissions add

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

and user allow permission photos and video

use permission_handler and

await Permission.photos.request();

useful to me

fishofeyes commented 4 months ago

work for me https://github.com/Gaya-Communities/flutter_screenshot_callback

AlexTs10 commented 2 months ago

It wasn't working for me either, added these three lines in the file below and now it works. If some could make a pull request that would be nice.

`///Users/alextoska/.pub-cache/hosted/pub.dev/screenshot_callback-3.0.1/android/build.gradle group 'com.flutter.moum.screenshot_callback' version '1.0'

buildscript { ext.kotlin_version = '1.6.10'

repositories {
    google()
    mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:7.1.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

rootProject.allprojects { repositories { google() mavenCentral() } }

apply plugin: 'com.android.library' apply plugin: 'kotlin-android'

android { namespace 'com.flutter.moum.screenshot_callback' // Add this line compileSdkVersion 33

defaultConfig {
    minSdkVersion 21
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
    disable 'InvalidPackage'
}

//added this
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
//added this
kotlinOptions {
    jvmTarget = '1.8'
}

}

dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }

repositories { mavenCentral() } `

Apliarte commented 1 month ago

For me, the solution of @AlexTs10 Thank you very much