Xamarin Forms Android FCM推送配置:WindowsAzure.MobileServices废弃包疑问
Hey there! Let's tackle your question about configuring Xamarin Forms push notifications for Android, especially with the deprecated WindowsAzure.MobileServices NuGet package.
Can I still use the deprecated WindowsAzure.MobileServices package for push setup?
While the package is marked as deprecated, it might still work for basic push notification configuration right now. That said, I’d strongly advise against sticking with it long-term: Microsoft has stopped all maintenance for this package. No more security patches, bug fixes, or compatibility updates for newer Xamarin Forms versions or Android OS releases. This will eventually lead to stability issues or security vulnerabilities in your app.
What’s the recommended alternative?
Microsoft’s official successor to WindowsAzure.MobileServices is the Azure.Mobile.Client NuGet package. It’s actively maintained, supports the latest Xamarin Forms and Android versions, and retains all the core push notification functionality you need.
Code Adjustments for the New Package
Good news: Your existing push registration code won’t need a complete overhaul. The MobileServiceClient class and its GetPush() method are still present in the new package. So your line of code:
await AzureNotificationHubService.RegisterAsync(TodoItemManager.DefaultManager.CurrentClient.GetPush(), token);
can mostly stay as-is. The main change you’ll need to make is updating the namespace in your using directives: replace Microsoft.WindowsAzure.MobileServices with Microsoft.Azure.Mobile.Client.
Quick Additional Tips
- If you’ve got a custom
AzureNotificationHubServiceclass, double-check that it’s compatible with the new package—you might need to tweak any internal dependencies it has. - Make sure to follow the latest official setup guides for push notifications with
Azure.Mobile.Client; these will have up-to-date steps for Android configuration that align with current platform requirements.
内容的提问来源于stack exchange,提问作者LittleFunny

