简体   繁体   English

当应用退出时,将远程通知(GCM)迁移到Xamarin.Android(monodroid)中

[英]Remote notification (GCM) into Xamarin.Android (monodroid) when app exit

I followed this tutorial 我遵循了本教程

The main problem is : 主要问题是:

  • What is WAKELOCK_KEY in their code ? 他们的代码中的WAKELOCK_KEY是什么? What I must put here ? 我必须在这里放什么?
  • What is classType in their code ? 他们的代码中的classType是什么? What I must put here ? 我必须在这里放什么?

For the WAKELOCK_KEY I just put "NOTIF", and for classType is use typeof(MyIntentService) . 对于WAKELOCK_KEY我只输入“ NOTIF”,对于classType使用typeof(MyIntentService)

I receive notification but can't receive notification when I kill the application. 我收到通知,但杀死应用程序后无法收到通知。 So how to manage this in Xamarin (no PushSharp or similar lib) ? 那么如何在Xamarin(没有PushSharp或类似的lib)中管理它呢?

(My code is the same as in the tutorial, except for WAKELOCK_KEY and classType). (除了WAKELOCK_KEY和classType,我的代码与教程中的代码相同)。

If you follow the tutorial, you just have to do that (seems my solution for the wakelock_key and the classType was good) :-) 如果您按照本教程进行操作,则只需执行此操作(似乎我的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);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM