Coder Social home page Coder Social logo

Comments (31)

Limizin avatar Limizin commented on September 18, 2024

No local sync point found

This is something LineageOS internal, but not a reason

The reason is that

    _locationManager.addGpsStatusListener(this);
    ...
     void onGpsStatusChanged(int event) {

the method onGpsStatusChanged is not called. I do not know why. Maybe because

  This method was deprecated in API level 24.
  use registerGnssStatusCallback(android.location.GnssStatus.Callback) instead. 
  No longer supported in apps targeting S and above. 

But it's not enough just up api level to 24 and use registerGnssStatusCallback. The system will start killing the service (an innovation in oreo), so the application has api level 23 to get around this limitation

I definitely can't do it. I'm not an android developer. I wrote this application by googling and did not write it for android anymore.

And I do not plan to, since I still use android 5 (I can not find a compact smartphone with large battery and IPS)

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

Thanks for your reply, @Limizin – tbh, I wasn't even sure if you're still around, so I'm happy you are! I've tooted a callout for help which already got quite a few favs and boosts, so I'm hoping someone will take a look soon and provide a PR.

What puzzles me is that it's not working on my FP2 running Android 10 with LOS, while it works fine on a FP3 running stock Android 10 (the one of my brother-in-law).

No longer supported in apps targeting S and above.

To me that sounds it should still be available to apps targeting R and below.

I still use android 5

Ouch. The only LP device I still use is my 7" tablet for eBook reading. Completely offline of course.

I can not find a compact smartphone with large battery and IPS

Always hard to find exact matches for one's needs. Define compact and large. There are some sites allowing you to filter for such things.

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

There are some sites allowing you to filter for such things.

there are sites, no compacts. a couple of years ago I did not change my smartphone, and now there is nothing - only phablets

To me that sounds it should still be available to apps targeting R and below.

Right. It should, but it doesn't work. Rather it works, but in its own way

In an effort to reduce power consumption, Android 8.0 (API level 26) limits how frequently an app can retrieve the user's current location while the app is running in the background. Under these conditions, apps can receive location updates only a few times each hour.

So minimal way to fix it. In this case, the icon will always be visible.

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

there are sites, no compacts. a couple of years ago I did not change my smartphone, and now there is nothing - only phablets

For example, 213 Android devices up to 4.7" (you can shrink further, and choose a min battery capacity as well).

I'm lost with the API details, though (I'm not and Android dev) – but yes, I've noticed that much more apps require a permanent notification icon nowadays, which I often find quite annoying. In case of GpsIcon, this could be limited a bit by have it only start when location is turned on, and stop the service when location service is disabled. Not sure if there's a broadcast for "location is in use" – if there's such, that would help keeping the current behavior.

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

try this. It is debug build.
app-debug.zip

I hate google and android 8+
(+) mean 'realized'...may be
1 oreo+ requires notification channel (+)
2 foreground service requires special notification otherwise after 5 seconds the service kills (+)
3 location changed now register in runtime (it's crazy) (+)
4 restarting service after oom. I have no idea how to do it (-)
5 after installation, you cannot touch GUI until the permissions are granted, otherwise the permission request icon will disappear (-)

MHO only item 4 is not enough for normal personal use

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

Thanks a lot! Sitting in my room certainly isn't the best place to test, but still:

  • granted the location permission via Android settings directly (wasn't offered the "always" option)
  • started the app to set it to digital ("always show" can no longer be unticked it seems; you already indicated something along those lines)
  • started some app to request location (OsmAnd)
  • Eagerly open the notifications and indeed now see "0/32" – no longer "0/0", so it definitely did something!
  • cross-checking with OsmAnd: numbers differ, OsmAnd toggles between 0/26 and 0/27 while GpsIcon sticks to 0/32 (the "0" is clear for all of them: no reception in this room with the blinds down)
  • switching OsmAnd off is detected fine: GpsIcon immediately stops blinking, stating "GPS inactive" (that didn't work before either, so it indicates something is working now)

Will test a bit more tomorrow, time to go to bed now (just having left the shower I don't want to open the blinds and go outside now). Will check my mail before that, just in case you've got another build 😜

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

It's unstable. If you turn on-off-on-off geolocation, it may stop working

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

No need to turn off/on. I just tried today outside: back at 0/0 while OsmAnd showed 4/32. But it still detects whether GPS is in use (which it didn't before).

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

app-debug2.zip
It is debug build - it writes debug log to logcat
also rebuilt under SDK 26 otherwise it just stalls

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

Wow! This one seems to work fine. Just tested with SatStat, GpsIcon was always half a second faster but apart from that in sync with what SatStat showed. Will keep an eye on it what it's doing "in the long run". Will report back then. If you have specific steps I should try, just let me know.

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

The background service, due to the START_STICKY flag, was restarted by the system itself if it was killed. Not everything is clear with foreground service.

It seems that closing the application in "recent" does not affect anything (and it was expected that it will kill the service) - this should be tested

It also seems that app need to somehow restart the service self if it was killed by the by oom - but I don't know how to get the oom for the test. I can only write code about which I will never know if it works

In general, you need to try to kill him in every possible way.
Also fast turn off/on/off/on/off in different modes of application operation

upd: if close app from 'recent' when location is off - the application will not come to life by itself. need to look for a way to be reborn. Previously, the "location chnaged" subscription did not require a running application, but now it does.

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

GpsIcon1.4.6(Q).zip

Signed release. This is all that I could. android O+ requires the service to be running all the time in order to catch location on / off events. But he also requires that there be a notification. And if I don't want to see the icon unnecessarily, then I have to keep the application running. How do I prevent killing the application? No idea. So all I can do is remove the app from recent and add some code to resurrect the app after killing oom which I can't even test

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

Yeah, that O+ requirement can be quite a pain in the … back – especially on smaller screens and if you have multiple apps having to meet it (here e.g. Tasker, AFWall+ and now GpsIcon). It fills the notification area unnecessarily. Unfortunately not much you can do about that with Android enforcing it (for whatever reasons).

I'm not an Android dev, so I've got no idea for alternative approaches of keeping an app from being killed by Doze or OOM. For the latter I vaguely remember one could play with values like oom_adj – for an app as small as yours that should be fine. As for doze, you could have it opt out from battery optimization.

For the signed release: Will you push the changes to the repo and make it a new version? 1.4.6 has been around for a while already 😉

Thanks a lot for all your efforts! A pity that my CallOut on Mastodon did not bring any help here, though it was boosted and liked quite a bit. Probably gained you a few more users…

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

I have pushed, but I use mercurial and I don’t know and I don’t want to know git - and instead of new branch it pushed on top... However, this is a failure - the android eventually unloads the application and I do not know how to prevent this.

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

Push arrived. Maybe make this versionCode: 11 and versionName: '1.4.7' (or anything of your choice)?

the android eventually unloads the application

I still keep watching it on my FP2 running Android 10. So far, it works reliably. But I didn't try to cause it any trouble, just was using it as I always do. And am happy that it works, thanks a lot!

and I do not know how to prevent this.

I'll add another shout at Mastodon. This is a question so generic that most Android devs should have asked it one point or the other.

When adding the new version to my repo, I'll put a note to stick with 1.4.6 unless it fails. Btw, did you decide for a license? If you don't care, there's always WTFPL and Unlicense 😆

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

It's just that you're in luck. In my case after 1-2 hours of sleep, the system unloads the application, and this is despite the flag in the settings "turn off battery optimization for this application". Suitable only for the lucky ones. Therefore, there is no sense in making a release

If you don't care, there's always WTFPL and Unlicense

Any license will suitable for me. After all, in fact, the application is abandoned

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

and this is despite the flag in the settings "turn off battery optimization for this application"

So have you been to Android settings and exempted it from battery optimization? AFAIK that flag just allows that step to be performed, but the user must have the final say to use it. But this might require Android 6+ (Doze was introduced with 6 IIRC). Not sure how 5 handles that.

After all, in fact, the application is abandoned

Ugh… Then a special thanks for maintaining an abandoned app I consider essential 😃 I cannot simply declare any license in my repo if you didn't declare it for the app, btw.

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

Not sure how 5 handles that.

This is tablet for test with android 10 (almost AOSP)

if you didn't declare it for the app, btw.

choose a license and tell me what to do

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

tablet for test with android 10

Ah, OK – there you should find exclusion from battery saving in the system settings.

choose a license and tell me what to do

Here's the howto for adding a license. If you want to make the code "public domain", The Unlicense would probably be the best choice. Otherwise you could pick any [A]GPL-2/3 from this list (they are more restrictive); MIT and Apache-2 are two of the most used permissive licenses, BSD-2 & 3 are also frequent. Not much ideas about the rest.

So basically, from most permissive to most restrictive I'd narrow down to: Unlicense › BSD/MIT/Apache › GPL3 › GPL2/AGPL. Shortest to read: Unlicense, BSD, MIT. Reading the GPLs will take a while 🤣

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

I chose Unlicense

In any case, there is no way to keep an application running without a foreground service. Well, maybe use JobScheduler to periodically try to restart, but this is unreliable

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

I chose Unlicense

Thanks! Thought so. Updated metadata on my end correspondingly.

there is no way to keep an application running without a foreground service.

Isn't that what you're currently doing? At least on my FP2, it is still running (from the first start).

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

Isn't that what you're currently doing?

Not. I start the foreground service only when the location is turned on - and the system will not touch this service.
But to enable the service, app need to subscribe to the "enable location" event - and according to the new rules, only the active running application can do this. If the application is unloaded, then it will stop receiving this notification. And so it does not work to keep it in memory - it is not a service, there is no icon, and therefore the system kills it

To keep an always running service with a notification just to use gps sometimes - I don't want to

I just removed the application from the "recent" ones so that the user does not interfere and he does not close it, as well as a possible restart if there is not enough memory, but this does not affect the unloading in any way - I have 6GB RAM on device with android 10 and 50% are always free

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

I start the foreground service only when the location is turned on

Ah, and because I never turned location entirely off, GpsIcon kept running. Yeah, that explains.

according to the new rules

which are only to protect us… I wish we were trusted with the decision which services we'd like running and which not – instead of having others decide what's in our best interest. Seems like what's really in our own interest is colliding with "theirs"…

So OK, one way to work around this is to have an app like Tasker start GpsIcon whenever location is turned on. Not elegant, but a work-around. If you happen to have such an app running, that is…

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

I wondered how the tasker kept itself running. I'm not sure, but I understood this - notification hannels appeared in android oreo + and one can configure each channel separately. Tasker creates a special notification and asks to hide it.

This means that I need to create an eternal service with a notification, which will observe location on/off and a separate notification channel for the satellite counter.

But I can’t modify code for all platforms. So, if I have time, I will try to fork repo and rebuild project for foreground service (for android 10+)

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

That sounds fantastic! And take your time: the "temporary version" seems to do the job for me on 10 – and as nobody else complained loudly, pressure seems to be low (though I got a bunch of likes for my Mastodon toot, so there seems to be interest).

When rewriting, you might consider one of the following options:

  • choose a different package name
  • set minSdk to Android 9 or 10

Both could of course be combined. Idea behind that: as up to Oreo the current version works fine, and functionality remains the same, this avoids "accidental updates" on Oreo and below. Also, this allows you to concentrate on select platforms (I took "I can’t modify code for all platforms" as referring to Android versions), e.g. Pie/Q and up, not having to take care for Oreo and below.

I will try to fork repo and rebuild project for foreground service (for android 10+)

Yupp, sounds good. Please make sure to set minSdk accordingly then 😉

Thanks a lot for taking care – and not giving up!

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

Just as a heads-up: that "temporary version" still works wonderfully on Android 11. Maybe it should be tagged and added as a new version to my repo, too?

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

still works wonderfully on Android 11

But it's not. It's just that you're lucky that the system doesn't kill the process. Therefore, it is correct to say "may work"

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

OK, that might be. Works for about a year now without any issues, first on Android 10 (LOS 17) then 11 (LOS 18) on a FP2. End of the month I get my ShiftPhone, we'll see how well it works there then. Thanks anyway – and I'll not put it public unless you say 😉

from gpsicon.

Limizin avatar Limizin commented on September 18, 2024

You can do whatever you want. That is, everything. For me, this repository is abandoned. In my current smartphone, gps works great and I no longer use this program. If suddenly I have time (highly unlikely) and the desire to write a version for 10+, then this will be a new repository from scratch.

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

Fair enough, thanks! In that as you wrote unlikely event, it'd be great if you remember me and let me know. Thanks a lot for all your support so far!

from gpsicon.

IzzySoft avatar IzzySoft commented on September 18, 2024

Works great on the SHIFT6mq as well. As you gave permission, I'd put it online – but the version I have has no matching signature, and carries the same versionName/versionCode as the last one already there. Would you mind a last compile with versionCode: 11 and versionName: "1.4.7" and your sig? I'd then add it to my repo together with a note that it's no longer developed (but works fine at least up to Android 11), and your "may work" warning from above. Thanks in advance!

from gpsicon.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.