|
|
@ -35,17 +35,27 @@ public class MyBoradCReceiver extends BroadcastReceiver { |
|
|
String content = bundle.getString(JPushInterface.EXTRA_ALERT); |
|
|
String content = bundle.getString(JPushInterface.EXTRA_ALERT); |
|
|
String typetime = bundle.getString(JPushInterface.EXTRA_EXTRA); |
|
|
String typetime = bundle.getString(JPushInterface.EXTRA_EXTRA); |
|
|
|
|
|
|
|
|
if (!JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) { |
|
|
|
|
|
|
|
|
if ((!"".equals(title) && title!=null) && (!"".equals(content) && content!=null) && (!"".equals(typetime) && typetime!=null)) { |
|
|
|
|
|
if (!JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) { |
|
|
NewsBean newsBean = new NewsBean(); |
|
|
NewsBean newsBean = new NewsBean(); |
|
|
newsBean.setTitle(title); |
|
|
|
|
|
newsBean.setContent(content); |
|
|
|
|
|
Gson gson = new Gson(); |
|
|
|
|
|
ReceiverNewsBean data = gson.fromJson(typetime,ReceiverNewsBean.class); |
|
|
|
|
|
|
|
|
if (title!=null) { |
|
|
|
|
|
newsBean.setTitle(title); |
|
|
|
|
|
} |
|
|
|
|
|
if (content!=null) { |
|
|
|
|
|
newsBean.setContent(content); |
|
|
|
|
|
} |
|
|
|
|
|
Gson gson = new Gson(); |
|
|
|
|
|
ReceiverNewsBean data = gson.fromJson(typetime, ReceiverNewsBean.class); |
|
|
newsBean.setTime(DateTimeUtil.getDateToString(data.getTimeStamp())); |
|
|
newsBean.setTime(DateTimeUtil.getDateToString(data.getTimeStamp())); |
|
|
newsBean.setType(data.getCategory()); |
|
|
|
|
|
|
|
|
if (data.getCategory()!=null) { |
|
|
|
|
|
newsBean.setType(data.getCategory()); |
|
|
|
|
|
}else { |
|
|
|
|
|
newsBean.setType("普通消息"); |
|
|
|
|
|
} |
|
|
newsBean.setRed(1); |
|
|
newsBean.setRed(1); |
|
|
newsBean.save(); |
|
|
newsBean.save(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|