通知栏异常 android.app.RemoteServiceException:Bad notifcation for Foreground :java.lang.ClassCastExceptio
2014-11-12 11:33
627 查看
通知栏异常,但可以正常使用,主要报错的机型是 SAMAUNG Galaxy SII/SIII/ SAMSUNG GT-i9220 M470BSA。
这个异常属于API异常,意思是你的通知栏需要一个PendingIntent ,这个PendingIntent 指向一个Intent可以做界面跳转,发送广播,开启Service之类的。
有些情况下我们没有在通知栏做跳转到界面之类的操作,可能只是开启手电筒,开启移动网络,蓝牙等操作,这种情况就不需要给Notification设置PendingIntent 大部分的机型是可以的,只有上述提到的机型会异常,我们只需要给设置一个Intent为空的PendingIntent就可以了。
代码:
异常截图:
这个异常属于API异常,意思是你的通知栏需要一个PendingIntent ,这个PendingIntent 指向一个Intent可以做界面跳转,发送广播,开启Service之类的。
有些情况下我们没有在通知栏做跳转到界面之类的操作,可能只是开启手电筒,开启移动网络,蓝牙等操作,这种情况就不需要给Notification设置PendingIntent 大部分的机型是可以的,只有上述提到的机型会异常,我们只需要给设置一个Intent为空的PendingIntent就可以了。
代码:
PendingIntent mPendingIntent = PendingIntent.getActivity(context, 0, new Intent(), PendingIntent.FLAG_CANCEL_CURRENT); mBuilder.setContentIntent(mPendingIntent);
异常截图:
相关文章推荐
- 通知栏异常 android.app.RemoteServiceException:Bad notifcation for Foreground :java.lang.ClassCastExceptio
- java.lang.ClassCastException: android.app.Application cannot be cast to 异常
- Android在绑定service的时候出现java.lang.ClassCastException:android.os.BinderProxy cannot be cast to ...异常
- 解决异常:java.lang.ClassCastException:android.app.Aplication cannot be cast to 类名
- java.lang.ClassCastException: android.app.Application cannot be cast to
- Android 用axis2 webService产生java.lang.ClassCastException: org.ksoap2.serialization.SoapPrimitive错误的解决
- java.lang.ClassCastException: android.app.Application cannot be cast to *****
- java.lang.ClassCastException: android.app.Application cannot be cast to greendroid.app.MyApplication
- Android 用webService产生java.lang.ClassCastException: org.ksoap2.serialization.SoapPrimitive错误的解决 .
- 解决android java.lang.ClassCastException android.app.Application
- java.lang.ClassCastException: android.app.Application cannot be cast to serialport_api.sample.App问题
- java.lang.ClassCastException: android.app.Application cannot be cast to serialport_api.sample.App问题
- java.lang.ClassCastException: android.widget.Button异常
- java.lang.ClassCastException: android.app.Application cannot be cast to serialport_api.sample.App问题
- java.lang.ClassCastException android.widget.RelativeLayout LayoutParams 异常
- java.lang.ClassCastException: android.app.ActionBar$LayoutParams cannot be cast to android.widget.Ab
- Android ListView分页时出现java.lang.ClassCastException: android.widget.HeaderViewListAdapter异常
- Android 用webService产生java.lang.ClassCastException: org.ksoap2.serialization.SoapPrimitive错误的解决 .
- java.lang.ClassCastException: android.app.Application cannot be cast
- java.lang.ClassCastException: android.app.Application cannot be cast to *****