Android Question GpsStatus APIs not supported, please use GnssStatus APIs instead

I want that my app works in all android versions (< and > API 31) But if I use GpsStatus event, get and error in Api 31 and > and if I use GnssStatus do not work in api < 24. So, What is the solution?
 

agraham

Expert
Licensed User
Longtime User
I assume you are using my GNSS library. There is no really neat solution as even if you try adding both GPS and GNSS libraries and selectively Dimming an instance of one or the other at runtime depending on the device API level you will still get the runtime error on API 31+ as you will have a GpsStatus event in your code unless you can make do with only the LocationChanged event. A separate apk for the earlier devices is probably the best solution if you need satellite status.
 
Upvote 0
I assume you are using my GNSS library. There is no really neat solution as even if you try adding both GPS and GNSS libraries and selectively Dimming an instance of one or the other at runtime depending on the device API level you will still get the runtime error on API 31+ as you will have a GpsStatus event in your code unless you can make do with only the LocationChanged event. A separate apk for the earlier devices is probably the best solution if you need satellite status.

Yes, I am using GNSS library and now I compile two different apk for new and old devices. But it is incredible that there is no solution for this. I just need to know the number of satellites used. But my app is published on PlayStore, I will probably publish two apps to fix it.
If anyone finds a solution, please share it.
 
Upvote 0
Has anyone tried this approach
 
Upvote 0
Top