[英]Xamarin Android GCM Shutting Down VM
When using Google Cloud Messaging on Xamarin Android the app is becoming unresponsive on register. 在Xamarin Android上使用Google Cloud Messaging时,该应用程序在注册时变得无响应。 Here is my code: 这是我的代码:
Thread t = new Thread (new ThreadStart (delegate {
Console.WriteLine ("Subscribing to Push Notifications");
try {
var gcm = GoogleCloudMessaging.GetInstance (this);
var key = gcm.Register (new string[]{ "12345678" });
Console.WriteLine ("Reg ID: " + key);
gcm.Close();
} catch (Exception ex) {
Console.WriteLine (ex.ToString ());
}
}));
t.Start ();
If I run gcm.Register
it freezes the app and logs: 如果我运行gcm.Register
它会冻结应用程序并记录日志:
Shutting down VM
Even weirder, is that I am getting the Registration ID successfully before it shuts down. 更奇怪的是,我在关闭之前成功获取了注册ID。
Any help would be appreciated. 任何帮助,将不胜感激。
万一这对将来的人有帮助,我设法通过删除所有过去的与推送通知相关的代码并遵循以下步骤来解决此问题: http : //developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/android/ remote_notifications_in_android /
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.