Skip to content
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

No notifications #87

Closed
MatsG23 opened this issue Nov 2, 2022 · 19 comments
Closed

No notifications #87

MatsG23 opened this issue Nov 2, 2022 · 19 comments
Labels
bug Something isn't working high priority This issue is a high priority

Comments

@MatsG23
Copy link

MatsG23 commented Nov 2, 2022

I do not receive notifications from Obtainium although I setup a background update checking interval. I sometimes opened the app and saw available updates. I have never received a notification from Obtainium since I used it.
I have given Obtainium the A13 permission for sending notifications and removed the battery optimization (is that even needed?). The notifications work for other apps of which some do not use FCM but background notifications too.

App version: 0.6.4
Device info: Pixel 6a running GrapheneOS (based on AOSP 13)

@ImranR98
Copy link
Owner

ImranR98 commented Nov 2, 2022

Interesting. When you opened the App, did you need to manually refresh or were the updates already there? In the latter case, it means that background checking does work, it just doesn't notify you. One thing to note is that Obtainium will only notify you of an update if it is new, meaning it did not already have an "update available" status - so if you swipe away the notification (or miss it somehow), it won't appear again. Is it possible you just missed it? Also keep in mind that the update interval is only approximate, Android ultimately decides when to do the task. I'm also on Graphene with Android 13, and notifications work fine for me.

Please try shortening the interval and see if that helps. Also, check your notification history (you'll need to enable this as it is off by default) and see if you get the "checking for updates" notification.

@ImranR98
Copy link
Owner

ImranR98 commented Nov 3, 2022

By @bluefly000 on #92 (copying here as it looks like the same issue):

Could you please add an option to keep Obtainium running in the background to check for updates?

I am using a Pixel6a running GrapheneOS and am having the same problem as mentioned in #87. Removing Obtainium from recent apps has stopped it from running in the background. Even without removing it from recent apps, using other apps, opening other profiles, etc. caused Obtainium to go into a suspended state and no longer check for updates in the background. Since there are no background update checks being done, there are no notifications. In my case, I only get notifications if I leave my smartphone for several hours after opening Obtainium.

I thought that adding this option would improve the reliability of the update checks in the background.

@ImranR98
Copy link
Owner

ImranR98 commented Nov 3, 2022

@bluefly000 could you check my previous comment and check some of the things I mentioned (check your notification history, shorten interval, etc.)

I tried reproducing this today by clearing Obtainium from the task list, but I see it is still checking for updates.

The Android API being used for background tasks is supposed to work even after reboot, so this is surprising.

@MatsG23
Copy link
Author

MatsG23 commented Nov 3, 2022 via email

@bluefly000
Copy link
Contributor

I set the interval to 1 hour on 4 Android devices, Galaxy A21 SC-42A, Galaxy A22 SC-56B, Pixel4a and Pixel6a running GrapheneOS. Then, I checked my notification history 10 hours after clearing Obtainium from my task list. Battery optimization was disabled.

As a result, only the Galaxy A21 SC-42A was successfully checking for updates.
For the Pixel4a it worked fine for the first 6 or 7 hours, but after that I did not receive any update checking notifications.
Oddly enough, for Pixel 6a, the Checking for Updates notification came after 4 hours, even though the interval was set to 1 hour. Also, that is the only notification that was coming.
In the case of the Galaxy A22 SC-56B, there was no Checking for Updates notification. I opened Obtainium and checked the date and time of the Last Update Check and found that Obtainium was not running in the background.

@ImranR98
Copy link
Owner

ImranR98 commented Nov 4, 2022

Very weird behaviour, especially since its inconsistent between devices. It looks like my phone is also running into this issue now for intervals above 1 hour.

Not sure what you meant by your last sentence there @bluefly000, there's no way to look at the last update check time in Obtainium (unless you're very quick). Each App does show the last update check time, but as soon as you open the app page it re-checks and so that time changes almost immediately.

Also, in the case of the Pixel 6a waiting 4 hours instead of 1 - was the screen off in the interim? If so, Android might have decided to wait until the phone was woken up (the interval time is like a suggestion, not exact, but I don't know if such a huge difference is normal).

It's possible this is due to fluttercommunity/flutter_workmanager#415 or fluttercommunity/flutter_workmanager#363 or both (if so, I'm not sure how it can be resolved). Ultimately the only working option might be to use a foreground service for update checking, but that's such a bad solution that really shouldn't be necessary.

@ImranR98 ImranR98 removed the needs follow up Further information is requested label Nov 4, 2022
@ImranR98
Copy link
Owner

ImranR98 commented Nov 4, 2022

In the meantime, I'll change the default interval to 1 hour and add a warning against changing it.

ImranR98 pushed a commit that referenced this issue Nov 4, 2022
@MatsG23
Copy link
Author

MatsG23 commented Nov 4, 2022

Very weird behaviour, especially since its inconsistent between devices. It looks like my phone is also running into this issue now for intervals above 1 hour.

Not sure what you meant by your last sentence there @bluefly000, there's no way to look at the last update check time in Obtainium (unless you're very quick). Each App does show the last update check time, but as soon as you open the app page it re-checks and so that time changes almost immediately.

Also, in the case of the Pixel 6a waiting 4 hours instead of 1 - was the screen off in the interim? If so, Android might have decided to wait until the phone was woken up (the interval time is like a suggestion, not exact, but I don't know if such a huge difference is normal).

It's possible this is due to fluttercommunity/flutter_workmanager#415 or fluttercommunity/flutter_workmanager#363 or both (if so, I'm not sure how it can be resolved). Ultimately the only working option might be to use a foreground service for update checking, but that's such a bad solution that really shouldn't be necessary.

Could you try this similar plugin and test if the problem still exists? I am using this plugin in a different project and have not experienced such planning issues.

android_alarm_manager_plus

@ImranR98
Copy link
Owner

ImranR98 commented Nov 4, 2022

Thanks! I'll try it out.

@ImranR98 ImranR98 added the high priority This issue is a high priority label Nov 4, 2022
@ImranR98
Copy link
Owner

ImranR98 commented Nov 5, 2022

I've switched to the AlarmManager plugin and everything seems to work. The only downside is that there's no way to make it wait for a network connection if there isn't one (previous plugin had this), so we just have to keep retrying every 15 minutes. It's probably fine (battery-life wise) since it only happens if the phone is awake (if asleep, it is woken up for normal update checks but not the 15-minute-later retries caused by network issues or rate limits - in those cases, we wait for wakeup).

I'll do a bit more testing today and release tomorrow. Will attach the APKs here in a while in case you want to test it out too @MatsG23 @bluefly000. If you do, you might want to remove Obtainium from your Apps list so it doesn't try to downgrade to the current release (that would fail anyways).

@ImranR98

This comment was marked as outdated.

ImranR98 added a commit that referenced this issue Nov 6, 2022
@ImranR98

This comment was marked as resolved.

@bluefly000
Copy link
Contributor

bluefly000 commented Nov 6, 2022

I tested on Pixel4a and Pixel6a. Notifications worked fine on both, but I got a package parse error and could not add and update apps.

I got a logcat when this error occurred.
logcat.txt

@bluefly000
Copy link
Contributor

I was able to add and install apps successfully with one version prior to the latest test version.

@ImranR98
Copy link
Owner

ImranR98 commented Nov 6, 2022

The good news is the notifications issue is fixed. The package parse error is a separate thing that apparently got introduced in the last release (will look into it). In the meantime I've deleted the latest release since this bug breaks App adding.

Update: Actually it does work in the latest version 0.6.6.

@bluefly000
Copy link
Contributor

bluefly000 commented Nov 6, 2022

Sorry for the lack of clarity. I am not referring to version 0.6.6 that is giving me an error, but the version attached 15 hours ago in this issue. When I said it worked fine, I meant the version attached to the comment marked as outdated.

@ImranR98
Copy link
Owner

ImranR98 commented Nov 6, 2022

@ImranR98
Copy link
Owner

ImranR98 commented Nov 6, 2022

@ImranR98 ImranR98 closed this as completed Nov 6, 2022
@S7venLights
Copy link

Nice work guys 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority This issue is a high priority
Projects
None yet
Development

No branches or pull requests

4 participants