【问题标题】:Remote notification (GCM) into Xamarin.Android (monodroid) when app exit应用退出时将远程通知 (GCM) 发送到 Xamarin.Android (monodroid)
【发布时间】:2013-06-25 09:45:59
【问题描述】:
我关注了这个tutorial
主要问题是:
- 他们的代码中的
WAKELOCK_KEY 是什么?我必须把什么放在这里?
- 他们的代码中的
classType 是什么?我必须把什么放在这里?
对于WAKELOCK_KEY,我只输入“NOTIF”,对于classType,使用typeof(MyIntentService)。
我收到通知,但在我终止应用程序时无法收到通知。那么如何在 Xamarin 中管理这个(没有 PushSharp 或类似的库)?
(我的代码和教程中的一样,除了 WAKELOCK_KEY 和 classType)。
【问题讨论】:
标签:
c#
notifications
xamarin.android
push
xamarin
【解决方案1】:
如果您按照教程进行操作,则只需这样做(似乎我的 wakelock_key 解决方案和 classType 很好)
:-)
[BroadcastReceiver]
[IntentFilter(new[] { Android.Content.Intent.ActionBootCompleted })]
public class BootReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
MyIntentService.RunIntentInService(context, intent);
}
}