cmeng-git / atalk-android

xmpp/jabber client for android
Apache License 2.0
155 stars 56 forks source link

Android notifications not for me. Must be me. *Edit=> Progress... #198

Closed paradisaeidae closed 1 year ago

paradisaeidae commented 1 year ago

Hi, Thanks Mr Eng Chong Meng for aTalk! It's impressive. So many bases being covered. I'm a recent user on Samsung S20FE 5G. Android 12, One UI 4.1. aTalk version 3.0.3 Most functions work well. Though I've not yet got the confluence of settings to enable notifications in notification drawer. Or the status bar. I do get a sound. I turn on Heads-up though they do not appear. I've tried notifications type Auto and org.atalk.impl.androidtray.... I've adjusted quiet hours so a nil:nil did not confuse in some way. Incoming message is ON with popup checked. I have developer options off. Have attempted numerous individual settings as suggested in FAQ. Have toggled the notifications type, restarted. This is a foundational function which must be in use by others. So it must be 'me'. I apologize for raising this issue. Thanks again for the app! All the best! MarkT

====EDIT!!===== I've just found the 'normal' type does get to the android tray when Popup notifications type is set to org.atalk.impl.androidtray.... Though chats do not. I can work with this. Still curious if this is intended! ====EDIT!!===== I also note there is no distinction between 'message' and 'chat' in the 'Configure individual notifications' options. Is it intended that chats are not pushed to androidtray? ====EDIT!!===== Although I've been able to see normal messages appear in androidtray this is not happening reliably. Sometimes when I quit atalk, restart atalk they will appear. Sometimes not.

cmeng-git commented 1 year ago

Android OS has undergone multiple changes to the way app notifications are being handled/restricted due to privacy.

Some of the aTalk notifications may misbehave on the latest android-OS; I have tested aTalk notifications, and are still working normally on my android-9 devices. I cannot be certain if all aTalk notifications are still working as expected on android-12. Need to verify.

cmeng-git commented 1 year ago

Found and fixed the problem with incorrect setting in MUTABLE flag added in android-S / android-M:

IllegalArgumentException: Not posted. PendingIntents attached to actions with remote inputs must be mutable

Has created common method to take care of the complexity in mutable flag setting which is android OS dependent

    public static int getPendingIntentFlag(boolean isMutable, boolean isUpdate)
    {
        int flag = isUpdate ? PendingIntent.FLAG_UPDATE_CURRENT : PendingIntent.FLAG_CANCEL_CURRENT;
        if (isMutable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
            flag |= PendingIntent.FLAG_MUTABLE;
        }
        else if (!isMutable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            flag |= PendingIntent.FLAG_IMMUTABLE;
        }
        return flag;
    }

The fix will be in next android release version 3.0.5

cmeng-git commented 1 year ago

Have just released aTalk v3.0.5. Please check and confirm once it is available on playstore.