当应用程序未运行或不在系统托盘中并且收到GCM通知时,Android应用程序崩溃 [英] Android Application get crashed when application is not running or not in system tray and received a GCM notification

查看:95
本文介绍了当应用程序未运行或不在系统托盘中并且收到GCM通知时,Android应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Xamarin和android的新手.我的Xamarin Android应用程式遇到问题.该应用程序崩溃了.当它关闭并收到来自服务器的GCM通知时.我已经应用了许多配置更改并更新了清单.

I am new on Xamarin and android. I am facing issue with my Xamarin Android app. The application is get crashed. when it closed and received a GCM notification from the server. I have applied many configurational changes and update the Manifest.

<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.packageName.permission.C2D_MESSAGE" />
<permission android:name="com.packagename.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<application android:icon="@drawable/logo" android:label="AppName">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="myKey" />
<supports-screens android:xlargeScreens="true" />

<receiver android:name="com.packagename.PushHandlerService"></receiver>
<receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
  <intent-filter>
    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    <category android:name="com.packagename" />
      <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:scheme="air.com.packagename.gcm"/>
  </intent-filter>
</receiver>
</application>

这是错误日志:PushNotificationRegistationIntentService-注册-
Java.IO.IOException:MISSING_INSTANCEID_SERVICE 在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()[0x0000c]处.

Here is the Error Log: PushNotificationRegistationIntentService - Register -
Java.IO.IOException: MISSING_INSTANCEID_SERVICE at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c].

推荐答案

我已解决此问题.我创建IntentService而不是Service. https://developer.android.com/reference/android/app/IntentService.html

I have fixed this issue. I create IntentService instead of Service. https://developer.android.com/reference/android/app/IntentService.html

我找到了一个Intent服务的示例: https://developer.xamarin.com/样本/monodroid/RemoteNotifications/

And I found an example for Intent service: https://developer.xamarin.com/samples/monodroid/RemoteNotifications/

这篇关于当应用程序未运行或不在系统托盘中并且收到GCM通知时,Android应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆