How to use Service Extension for UNNotificationServiceExtension with MAUI ?

Peter Bozovic 1 Reputation point
2022-06-14T20:08:27.127+00:00

I'm trying to implement iOS push notifications by following this guide:
https://learn.microsoft.com/en-us/xamarin/ios/platform/user-notifications/enhanced-user-notifications

At the end, there is "Implementing a Service Extension" which is exactly what I need since I have encrypted messages.
But I don't see how to do this with MAUI project or new net6-android framework ?

If someone have some example or can point me in the right direction I would be very grateful !

Thanks :)

Developer technologies | .NET | .NET MAUI
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2022-07-12T10:12:48.153+00:00

    Hello @Peter Bozovic ,

    You can refer to the above Xamarin guide doc to implement a service extension in MAUI project.

    1. Use the latest Visual Studio 2022 Preview and create a .net MAUI app.
    2. Follow the doc to implement a Notification Service Extension, the UserNotificationCenterDelegate should be under the Platforms/iOS folder in MAUI ( it's under iOS project in Xamarin)
    3. Set the MAUI project as your main project, and add the extension project as a reference to within the MAIN MAUI app: right-click the solution, click "Set as Startup Project", then right-click "Dependencies", click "Add Project Reference" and check the Notification Service Extension you created.

    If you have any other issues, please feel free to let me know.

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.