繁体   English   中英

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

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

我遵循了本教程

主要问题是:

  • 他们的代码中的WAKELOCK_KEY是什么? 我必须在这里放什么?
  • 他们的代码中的classType是什么? 我必须在这里放什么?

对于WAKELOCK_KEY我只输入“ NOTIF”,对于classType使用typeof(MyIntentService)

我收到通知,但杀死应用程序后无法收到通知。 那么如何在Xamarin(没有PushSharp或类似的lib)中管理它呢?

(除了WAKELOCK_KEY和classType,我的代码与教程中的代码相同)。

如果您按照本教程进行操作,则只需执行此操作(似乎我的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