Add channel to notifications.

Authored by nicolasfella on Dec 27 2017, 2:53 PM.



Oreo requires that each notification has a channel assigned. This patch uses a common channel for all. Individual channels for different notifications (Notifications plugin, pairing notifications, share plugin) could be done, but
since in our case notifications are not a critical part of the UX it does not seem necessary to me. Setting the channel on NotificationCompat.Builder requires version 26 of the support library, the implications of this were
discussed in D8966.

Diff Detail

R225 KDE Connect - Android application
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
nicolasfella requested review of this revision.Dec 27 2017, 2:53 PM
nicolasfella created this revision.

Optimize imports

Silence exception in NotificationsPlugin

Oops, that was meant to come in a different revision

Remove imports again

At some point we should bump to API 26 and then also merge D8966, but I'm unsure if this si something we should do right now or if it can wait. In the case of this patch, probably there is a "compatibility" behaviour for old apps that don't set a channel. I'm not sure what's that behavior, but maybe we can go with that for a while? If they just don't work, then it means we should bump to 26 asap, but I don't think they went that way.

Targeting Oreo has to wait until we made all the necessary changes, that's why I did not bump it yet. The NotificationCompat.Builder(context, channelD) accepts an empty channel on target < Oreo, the problem is that it doesn't compile without version 26 of the support library.

Looks good to me, and still works on Android 7.1.

Regarding the compability with old android versions: we could release a final version of the app for API version < 14. Then users of old versions still have a working app, although they won't get updates anymore.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 24 2018, 12:06 AM
This revision was automatically updated to reflect the committed changes.