我試圖在我的Xamarin.Forms應用程序中實現推送通知。
我已經按照this Microsoft doc,但我對Xamarin.Forms Azure推送通知 - 「MobileServiceInvalidOperationException:您無權查看此目錄或頁面」
await push.RegisterAsync(RegistrationID, templates);
線得到一個Unauthorized
錯誤。例外情況如下:
Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: You do not have permission to view this directory or page.
我已經加入了Sender ID
(從火力地堡)(他們稱之爲「項目編號」中的文檔)
public class PushHandlerBroadcastReceiver : GcmBroadcastReceiverBase<GcmService>
{
public static string[] SENDER_IDS = new string[] { "<my_sender_id_here>" };
}
我還添加了Server key
(從火力地堡)添加到Azure門戶的通知中心的「Google(GCM)API密鑰」中。
我已登錄到我的AVD上的Google帳戶。 (我也使用Azure AD B2C登錄Azure MobileServicesClient,但我認爲這不重要。)
我找到了other people with this same issue(搜索「許可」,直接鏈接不起作用),但它只有一個實例。沒有人提供解決方案。
我缺少什麼?
不能說我遇到過任何經典的Google。謝謝!我會嘗試一下! – Marcus
這對我有效,我使用了替代代碼('client.InvokeApiAsync(...)'方法,而不是'push.RegisterAsync(...))。謝謝阿德里安! –
Marcus