flutter_smart_auth
flutter_smart_auth copied to clipboard
On Android API 34 (Android 14) sms retriever not working. Need to change codes as mentioned in official documentation.
I have ready solution. Need to change gradle dependencies. dependencies to given below:
build.gradle:
group 'fman.ge.smart_auth'
version '1.0-SNAPSHOT'
buildscript {
// ext.kotlin_version = '1.10.1'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
// Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) {
namespace 'fman.ge.smart_auth'
}
compileSdkVersion 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion 16
}
}
dependencies {
implementation "androidx.core:core-ktx:1.10.1"
implementation 'com.google.android.gms:play-services-auth:20.7.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
}
Then in SmartAuthPlugin.kt
code from line 241 to 247 given below:
mContext.registerReceiver(
smsReceiver,
IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION),
SmsRetriever.SEND_PERMISSION,
null,
)
need to change to :
val intentFilter = IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION)
ContextCompat.registerReceiver(
mContext,
smsReceiver,
intentFilter,
SmsRetriever.SEND_PERMISSION,
null,
ContextCompat.RECEIVER_EXPORTED
)
When I include ContextCompat how in this solution, I get an error.
When I include ContextCompat how in this solution, I get an error.
You should update gradle file also as given above. After errors with ContextCompat must disappear
any updates ?
Hey guys, I'll check the PR today.
Any update for API 34? My app has been crashed when start OTP using package Pinput but the main error is trigger from smart auth package.
E/MethodChannel#fman.smart_auth(22790): java.lang.SecurityException: com.example.app: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
Hey @Tkko, thanks for sharing this. Any update on support for Android 14?
Merged the PR The changes are included in version 2.0.0
Hello there, Hope you're doing great. I'm getting a error whenever the message is recieved "E/Pinput/SmartAuth(22173): Retrieved SMS is null, check if SMS contains correct app signature"
Hello there, Hope you're doing great. I'm getting a error whenever the message is recieved "E/Pinput/SmartAuth(22173): Retrieved SMS is null, check if SMS contains correct app signature"
Please checkout the readme.