К основному контенту

Сообщения

Сообщения за сентябрь, 2020

Local notifications in Android with Xamarin

I've been developing an Android mobile app for my pet project. I chose Xamarin framework as a tool just because I'm familiar with C# (even probably writing a native app is much better idea). Since I'm not a mobile developer I've been facing issues from time to time. In particular I realized that enabling local notifications (e.g. reminders) is not that much clear as I would love to. So, this post will go through few steps showing how to set a local notification (or reminder). The info is up-to-date in September, 2020. NB: the post is relevant for Android 8.0 (Oreo) and higher since a feature of notification channels was introduced for those versions (see details here ). The code was tested on a phone with Android 9.0 Pie. Let's start. To demonstrate the process I built a simple app with just two buttons. See code in my Github repository . One button is to set a notification at a selected day and time. Another button will cancel the already set notif