-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App crashed with targetSdkVersion 34, Error: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified #200
Comments
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. |
@LukasP94 I was facing the same issue. I have fixed that into this forked version Usage
|
This problem was cleared, but it also appears to have another problem, but all the permissions are given by the user:
|
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. |
I made a fork here: https://github.com/lukaskurz/background_location/tree/master This fork contains fixes for both the issues mentioned by @LukasP94 as well as the issues found in the other fork described by @sisalik1 . I tested it on emulator with API 34 as well as API 29/30 on device, so it should work with both before/after API 33 changes. |
Same here |
@lukaskurz I tried using your fork on my Samsung A52s (API 34), but it did not compile,
|
I was able to fix this by running flutter clean:
|
same here |
None of the solutions work for me!
App crashes: |
None of the previous solutions work for me :( Error text: |
i can confirm that using the forked repo from @lukaskurz now the app works fine, i hope these fixes will be merged into official plugin repo |
How this issue still hangs here, there are solution suggestions and so many developers needs this. Do you still maintain this package @Almoullim ? |
@BWMuller can you please check this issue? |
@nzackoya Sure. I'll have a look |
@BWMuller thanks man |
Hey guys, any news on the fix? |
@nzackoya @darkrevenger Currently the main issue with this repo being updated is the lack of independent verification of PRs. I know that this SDK34 issue is fixed in #208 as I haven't experienced it myself in my own prod deployed application. I haven't managed to get a UI test to work where it successfully grants the permissions required and does a mock location event as the independent test. If anyone here has experience in that please give it a try so that we can have a easier update cycles. Alternatively have a look at the PR, test it on your side and add a comment there if you found any issues. That way "independent" would just change to multiple external people vouching instead which should make it easier for @MoralCode to verify |
add these permission
then it will work and make sure to use like this class
|
Unfortunately i dont have access to pub.dev. If the fix for this is already on main i can make a "pending release" tag to make the status clearer. Ill go do that |
Some hint for publishing a new version for a existing app with the above changes via Google Play Store: I have a automated build pipeline which pblish my app into the internal test track in Google Play Store. After consuming the master branch of "background_location" in my app and try to publish this in Playstore, I got the error: "You must let us know whether your app uses any Foreground Service permissions.". The only way I found to solve this, is to manually upload the aab file to the track. Only then I got a new policy declaration entry in "App content" section where I have to explain why my app needs the foreground service. |
It's not related to the issue above. You can find a notification service called in foreground in LocationUpdateService.kt Therefore you must add ForgroundService declaration. |
Hi, I am still experiencing issues with the background_location package on Android 13 with target SDK 34. Despite following all the recommended steps, including adding the necessary permissions like FOREGROUND_SERVICE_LOCATION in the manifest, my app crashes with the error: ` Is there a specific configuration or workaround needed for Android 13 or SDK 34 that I might be missing? Any guidance on how to proceed would be greatly appreciated. Thank you! |
Caused by: java.lang.SecurityException: Starting FGS with type location callerApp=ProcessRecord{c980963 4073:com.dulb.solid_waste_management/u0a436} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_LOCATION] any of the permissions allOf=false [android.permission.ACCESS_COARSE_LOCATION, android.permission.ACCESS_FINE_LOCATION] and the app must be in the eligible state/exemptions to access the foreground only permission background_location: Please help guys- its urgent |
|
USE THIS PERMISSION uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"
|
Hello,
when app is targeting SDK 34, then app crashes as soon as BackgroundLocation.startLocationService() is called. See stacktrace
D/AndroidRuntime( 8320): Shutting down VM
E/AndroidRuntime( 8320): FATAL EXCEPTION: main
E/AndroidRuntime( 8320): Process: com.company.myapp.dev, PID: 8320
E/AndroidRuntime( 8320): java.lang.RuntimeException: Unable to create service com.almoullim.background_location.LocationUpdatesService: java.lang.SecurityException: com.company.myapp.dev: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
E/AndroidRuntime( 8320): at android.app.ActivityThread.handleCreateService(ActivityThread.java:4684)
E/AndroidRuntime( 8320): at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
E/AndroidRuntime( 8320): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2269)
E/AndroidRuntime( 8320): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 8320): at android.os.Looper.loopOnce(Looper.java:205)
E/AndroidRuntime( 8320): at android.os.Looper.loop(Looper.java:294)
E/AndroidRuntime( 8320): at android.app.ActivityThread.main(ActivityThread.java:8194)
E/AndroidRuntime( 8320): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 8320): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/AndroidRuntime( 8320): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
E/AndroidRuntime( 8320): Caused by: java.lang.SecurityException: com.company.myapp.dev: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
E/AndroidRuntime( 8320): at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
E/AndroidRuntime( 8320): at android.os.Parcel.createException(Parcel.java:3041)
E/AndroidRuntime( 8320): at android.os.Parcel.readException(Parcel.java:3024)
E/AndroidRuntime( 8320): at android.os.Parcel.readException(Parcel.java:2966)
E/AndroidRuntime( 8320): at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5684)
E/AndroidRuntime( 8320): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1852)
E/AndroidRuntime( 8320): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1792)
E/AndroidRuntime( 8320): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1780)
E/AndroidRuntime( 8320): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:755)
E/AndroidRuntime( 8320): at com.almoullim.background_location.LocationUpdatesService.onCreate(LocationUpdatesService.kt:154)
E/AndroidRuntime( 8320): at android.app.ActivityThread.handleCreateService(ActivityThread.java:4671)
E/AndroidRuntime( 8320): ... 9 more
E/AndroidRuntime( 8320): Caused by: android.os.RemoteException: Remote stack trace:
E/AndroidRuntime( 8320): at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:13995)
E/AndroidRuntime( 8320): at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
E/AndroidRuntime( 8320): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2763)
E/AndroidRuntime( 8320): at android.os.Binder.execTransactInternal(Binder.java:1332)
E/AndroidRuntime( 8320): at android.os.Binder.execTransact(Binder.java:1278)
E/AndroidRuntime( 8320):
Thank you for advance for fixing that!
The text was updated successfully, but these errors were encountered: