3
使用Xamarin Forms開發移動應用程序。對於推送通知,我們使用亞馬遜簡單通知服務(SNS)。使用Amazon SNS的推送通知 - 設備ID
Xamarin.Andriod: 1.在安裝該應用程序,我們使用了下面的代碼段要註冊的設備ID到亞馬遜SNS中MainActivity的onCreate方法。它工作正常
using (Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER"))
{
string senders = AmazonUtils.GoogleConsoleProjectId;
intent.SetPackage("com.google.android.gsf");
intent.PutExtra("app", PendingIntent.GetBroadcast(this, 0, new Intent(), 0));
intent.PutExtra("sender", senders);
this.StartService(intent);
}
當應用打開檢查相應的設備ID在亞馬遜SNS中註冊每一次。由於此應用程序需要額外的4秒來檢查此過程,並在該頁面加載之後。
我們是否需要在應用程序每次打開時檢查設備是否註冊?這是推送通知的標準嗎?
問候, 基蘭