2016-09-28 49 views
0

我有一個問題,對於xamarin GCM實施Xamarin的Android GCM instanceID.GetToken拋出超時異常

這裏是我的代碼示例

var instanceID = InstanceID.GetInstance(context.ApplicationContext); 
token = instanceID.GetToken("MYSENDERID", GoogleCloudMessaging.InstanceIdScope, null); 

它的工作在另一個線程(不是主線程) instanceID.GetToken拋出錯誤(我給所有權限)

錯誤:

Java.IO.IOException: TIMEOUT 
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
    at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00064] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono. 
+0

請在您的文章中包含錯誤。 –

+0

請[編輯]您的問題添加更多的細節。 –

回答

1

我修好了。

原因是我忘記了創建服務。它只適用於服務