Etar-Group / Etar-Calendar

Android open source calendar
https://f-droid.org/packages/ws.xsoh.etar/
GNU General Public License v3.0
2.04k stars 393 forks source link

No notification at all, all of a sudden #1179

Open CelianGdfrd opened 2 years ago

CelianGdfrd commented 2 years ago

For a couple of weeks now, Etar basically refuses to give me any notification from my events on my phone. No idea what's the cause.

Battery notification is disabled.

Sorry for the lack of precision, but I have to admit, I'm puzzled.

CelianGdfrd commented 2 years ago

Just tried clearing the cache and deleting app data : it fixed the problem for one event, which notification went right. Then it stopped working again.

Gitsaibot commented 2 years ago

Maybe #1026 helps...

CelianGdfrd commented 2 years ago

@Gitsaibot I'm not sure it's related to this. I've disabled battery optimization from day 1, to this day. It's still not helping.

CelianGdfrd commented 2 years ago

I've seen people suggest to add the Etar widget on homepage to fix the notification issue : can confirm it DOES NOT work for me either.

Gitsaibot commented 2 years ago

I think that in your case only a debug log will help to identify the problem.

CelianGdfrd commented 2 years ago

Sure, could someone show me how to do this please ?

CelianGdfrd commented 2 years ago

Alright, absolutely not sure whether this will be helpful, but still.

07-20 02:55:00.002  1627  1955 V AlarmManager: Triggering alarm #0: 3 when =92835464 package =android operation = null listenTag =TIME_TICK flags =0x1
07-20 02:55:00.003  1627  1955 V AlarmManager: Triggering alarm #1: 0 when =1658278500000 package =com.android.providers.calendar operation =*walarm*:android.intent.action.EVENT_REMINDER flags =0x5
07-20 02:55:00.003  1627  1955 V AlarmManager: Triggering alarm #2: 1 when =1658278500000 package =cz.martykan.forecastie operation =*alarm*:cz.martykan.forecastie.UPDATE_TIME flags =0x9
07-20 02:55:00.022  2612  2807 I ClockCtrl:  schedule next: 59978
07-20 02:55:00.022  2612  2807 I OpKeyguardUpdateMonitor: onTimeChanged
07-20 02:55:00.031  2612  2612 D KeyguardUpdateMonitor: received broadcast android.intent.action.TIME_TICK
07-20 02:55:00.041  2612  2612 D KeyguardUpdateMonitor: handleTimeUpdate
07-20 02:55:00.081  1627  2400 D SensorService: FusionLight, after outEvent->light = 0.000000[LB]
07-20 02:55:00.113 29937 29937 D AlertReceiver: onReceive: a=android.intent.action.EVENT_REMINDER Intent { act=android.intent.action.EVENT_REMINDER dat=content://com.android.calendar/1658278500000 flg=0x1000014 cmp=ws.xsoh.etar/com.android.calendar.alerts.AlertReceiver (has extras) }
07-20 02:55:00.161  1627  1647 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service ws.xsoh.etar/com.android.calendar.alerts.AlertService
07-20 02:55:00.163 29937 25680 D AlertService: 1658278500000 Action = android.intent.action.EVENT_REMINDER
07-20 02:55:00.163 29937 25680 I GlobalDismissManager: no sender configured
07-20 02:55:00.163 29937 29937 D ActivityThread: pid:29937 tid:29937 doframe Callback
07-20 02:55:00.163 29937 25680 D AlertService: Beginning updateAlertNotification
CelianGdfrd commented 2 years ago

Did these logs help ? do you need anything else ?

woheller69 commented 2 years ago

removing battery optimization does not help in my case on Android 12... v1.0.30

woheller69 commented 2 years ago

For whatever reason: after uninstalling an reinstalling the app it now works with removed battery optimization

CelianGdfrd commented 2 years ago

Yeah, it also worked for me. For one event. Then it stopped working again.

woheller69 commented 2 years ago

maybe due to an OS update?

https://dontkillmyapp.com/

CelianGdfrd commented 1 year ago

Alright, well, still nothing after months. Battery optimization is off (as it has always been), still no notification for my events. I can't imagine I'm the only person who encounters this.

I used Etar every day, and it just got killed for me overnight.

jspricke commented 1 year ago

From the log above:

07-20 02:55:00.161  1627  1647 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service ws.xsoh.etar/com.android.calendar.alerts.AlertService

So maybe we need to request an other permission for the alert?

CelianGdfrd commented 1 year ago

I always made sure that Etar was granted all permissions it requested, at all times. So that's Notifications, Agenda and Contacts, I believe.

jspricke commented 1 year ago

I am talking about Etar requesting additional permissions from the system so the user can grant them. For older Android this seems to be missing: https://developer.android.com/training/scheduling/alarms#exact

CelianGdfrd commented 1 year ago

This bug has been happening to me since June 2022, on Android 12, 13, since version 1.0.33 of the app. I believe it's a system update (OxygenOS back then) that killed it overnight.

Now I'm using LineageOS, that brings Etar as native calendar app, and the bug happens again.

Logcat available here : https://gitlab.com/LineageOS/issues/android/-/issues/5407

Gitsaibot commented 1 year ago

So maybe we need to request an other permission for the alert?

I do not understand how this error message can occur at all. Where does the "Etar Alert.Service" ask for location/camera/microphone access?

https://android.googlesource.com/platform/frameworks/base.git/+/master/services/core/java/com/android/server/am/ActiveServices.java

jspricke commented 1 year ago

I assume that logging message is missleading and we need the SCHEDULE_EXACT_ALARM permission.

woheller69 commented 1 year ago

So maybe we need to request an other permission for the alert?

I do not understand how this error message can occur at all. Where does the "Etar Alert.Service" ask for location/camera/microphone access?

https://android.googlesource.com/platform/frameworks/base.git/+/master/services/core/java/com/android/server/am/ActiveServices.java

I think this error is more like an information in case we wanted to use location/camera/microphone. In this case you have to declare it for the service in Manifest for newer Android (I think from Android 11). Not needed here.

I would try to stick to SCHEDULE_EXACT_ALARM permission. But you need to request it for Android 13.

//SCHEDULE_EXACT_ALARM: on Android 12 this permission is automatically granted by the Android system but on Android 13 
we need to check if the user has granted this permission.
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
            if (!alarmManager.canScheduleExactAlarms()) {
                Intent intent2 = new Intent();
                intent2.setAction(Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM);
                startActivity(intent2);
            }
        }
ploink commented 1 year ago

Also no notifications on my phone. I am still on Android 10 and the system has not been updated for a long time. Also many appointments have been entered a long time ago and there have been no changes on the server side. I only update apps so now and then. I will try downgrading Etar and report back later.

Edit: Downgraded to v1.0.30 using xdowngrader, keeping all app data and notifications work fine now.

CelianGdfrd commented 1 year ago

Okay, so now it stopped working again. Here's what I find in my logcat on the time of scheduled notification :

05-20 18:55:01.581 1785 2343 I ActivityManager: Background started FGS: Allowed [callingPackage: ws.xsoh.etar.debug; callingUid: 10208; uidState: RCVR; intent: Intent { cmp=ws.xsoh.etar.debug/com.android.calendar.alerts.AlertService (has extras) }; code:SYSTEM_ALLOW_LISTED; tempAllowListReason:<,reasonCode:SYSTEM_ALLOW_LISTED,duration:9223372036854775807,callingUid:-1>; targetSdkVersion:33; callerTargetSdkVersion:33; startForegroundCount:0; bindFromPackage:null] 05-20 18:55:01.597 1785 2880 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service ws.xsoh.etar.debug/com.android.calendar.alerts.AlertService 05-20 18:55:01.606 1785 2343 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service ws.xsoh.etar.debug/com.android.calendar.alerts.AlertService

woheller69 commented 1 year ago

does the new apk in https://github.com/Etar-Group/Etar-Calendar/issues/1360 work?

CelianGdfrd commented 1 year ago

Well, I'll give it a shot, but failing can start happening after quite some time.

Hope your merge will be accepted this time, thanks a lot for your help

CelianGdfrd commented 1 year ago

Failed aswell with the new APK.

05-25 18:30:01.405 1800 8323 I ActivityManager: Background started FGS: Allowed [callingPackage: ws.xsoh.etar.debug; callingUid: 10234; uidState: RCVR; intent: Intent { cmp=ws.xsoh.etar.debug/com.android.calendar.alerts.AlertService (has extras) }; code:SYSTEM_ALLOW_LISTED; tempAllowListReason:<,reasonCode:SYSTEM_ALLOW_LISTED,duration:9223372036854775807,callingUid:-1>; targetSdkVersion:33; callerTargetSdkVersion:33; startForegroundCount:0; bindFromPackage:null] 05-25 18:30:01.422 1800 8323 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service ws.xsoh.etar.debug/com.android.calendar.alerts.AlertService 05-25 18:30:01.432 1800 9611 W ActivityManager: Foreground service started from background can not have location/camera/microphone access: service ws.xsoh.etar.debug/com.android.calendar.alerts.AlertService

ploink commented 1 year ago

does the new apk in #1360 work?

Works for me, v1.0.33 works too, but 1.0.34 does not. Android 10, crdroid(lineage based).

mjip commented 1 year ago

The same is happening for me, Android 11. Started happening in one of the most recent updates.