Hi guys,
I'm implementing Push Notification
in my app with AppCenter
. In UWP I created a background service to receive message when the app is closed. I'm trying to do the same with Android
and, later, iOS
.
In Android
project I created a IntentService
to initialize the Push
from AppCenter
but it doesn't work.
[Service]
public class PushNotificationService : IntentService
{
public override void OnCreate()
{
if (!AppCenter.Configured)
{
Push.PushNotificationReceived += (sender, e) =>
{
new NotificationHelpers().ShowNotification(e.Title, e.Message, e.CustomData);
};
}
}
public override IBinder OnBind(Intent intent)
{
return null;
}
[return: GeneratedEnum]
public override StartCommandResult OnStartCommand(Intent intent, [GeneratedEnum] StartCommandFlags flags, int startId)
{
return StartCommandResult.StickyCompatibility;
}
protected override void OnHandleIntent(Intent intent)
{
}
}
What is the correct implementation for Android
? Thank you