android / platform-samples

A collection of samples of different Android OS platform APIs.
https://developer.android.com/about
Apache License 2.0
1.14k stars 244 forks source link

[Bug]: java.lang.SecurityException on Create and monitor Geofence #196

Closed Abdulmanan475 closed 3 weeks ago

Abdulmanan475 commented 2 months ago

Is there an existing issue for this?

In which area is the issue?

Location

In a specific sample?

GeofenceBroadcastReceiver.kt

What happened?

I am using android 14 and getting crash on

https://github.com/user-attachments/assets/80b2f411-456a-4b6e-9f78-f38297600963

Relevant logcat output

java.lang.SecurityException: com.example.platform.app: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
                                                                                                        at android.os.Parcel.createExceptionOrNull(Parcel.java:3071)
                                                                                                        at android.os.Parcel.createException(Parcel.java:3055)
                                                                                                        at android.os.Parcel.readException(Parcel.java:3038)
                                                                                                        at android.os.Parcel.readException(Parcel.java:2980)
                                                                                                        at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6416)
                                                                                                        at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1876)
                                                                                                        at android.app.ContextImpl.registerReceiver(ContextImpl.java:1811)
                                                                                                        at android.app.ContextImpl.registerReceiver(ContextImpl.java:1799)
                                                                                                        at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:755)
                                                                                                        at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:755)
                                                                                                        at com.example.platform.location.geofencing.GeofenceBroadcastReceiverKt$GeofenceBroadcastReceiver$1.invoke(GeofenceBroadcastReceiver.kt:63)
                                                                                                        at com.example.platform.location.geofencing.GeofenceBroadcastReceiverKt$GeofenceBroadcastReceiver$1.invoke(GeofenceBroadcastReceiver.kt:41)
                                                                                                        at androidx.compose.runtime.DisposableEffectImpl.onRemembered(Effects.kt:83)
                                                                                                        at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchRememberObservers(Composition.kt:1295)
                                                                                                        at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:984)
                                                                                                        at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:1005)
                                                                                                        at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1099)
                                                                                                        at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3599)
                                                                                                        at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:633)
                                                                                                        at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:619)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcomposeInto(SubcomposeLayout.kt:500)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:472)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:463)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:447)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(SubcomposeLayout.kt:872)
                                                                                                        at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1.invoke-0kLqBqw(Scaffold.kt:285)
                                                                                                        at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1.invoke(Scaffold.kt:179)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:709)
                                                                                                        at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126)
                                                                                                        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:252)
                                                                                                        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:251)
                                                                                                        at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2303)
                                                                                                        at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:500)
                                                                                                        at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:256)
                                                                                                        at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
                                                                                                        at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
                                                                                                        at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1617)
                                                                                                        at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:36)
                                                                                                        at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:620)

Code of Conduct

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.