0

after updating my android app in sdk 34 app showing

java.lang.SecurityException: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts at android.app.ActivityThread.handleCreateService(ActivityThread.java:5202) at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2650)

dependencies {

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'


implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'me.hiennguyen.circleseekbar:circleseekbar:1.0.1'
implementation 'me.itangqi.waveloadingview:library:0.3.5'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation "androidx.browser:browser:1.3.0"
implementation 'com.github.prolificinteractive:material-calendarview:2.0.1'
implementation 'com.shawnlin:number-picker:2.4.11'
implementation 'com.google.android.material:material:1.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.google.android.gms:play-services-ads:22.2.0'
implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
implementation 'com.android.volley:volley:1.1.0'
implementation 'androidx.work:work-runtime-ktx:2.7.1'

}

1 Answer 1

1

According to the developer's documentation:

Apps and services that target Android 14 (API level 34) or higher and use context-registered receivers are required to specify a flag to indicate whether or not the receiver should be exported to all other apps on the device: either RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED, respectively. This requirement helps protect apps from security vulnerabilities by leveraging the features for these receivers introduced in Android 13.

for more details: https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported

Code sample:

Context.registerReceiver(receiver, filter, RECEIVER_EXPORTED);
            // or 
registerReceiver(receiver, filter, RECEIVER_NOT_EXPORTED);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.