use of com.benmu.framework.model.NotificationBean in project WeexErosFramework by bmfe.
the class ResultActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
if (intent == null || intent.getStringExtra("type") == null)
return;
String type = intent.getStringExtra("type");
switch(type) {
case Constant.Action.ACTION_NOTIFICATION:
// 点击通知
Serializable serializable = intent.getSerializableExtra(Constant.Notification.TAG_NOTIFICATION);
if (serializable instanceof NotificationBean) {
NotificationBean bean = (NotificationBean) serializable;
// 发送事件
Activity activity = RouterTracker.peekActivity();
if (activity instanceof AbstractWeexActivity) {
WXSDKInstance wxsDkInstance = ((AbstractWeexActivity) activity).getWXSDkInstance();
GlobalEventManager.pushMessage(wxsDkInstance, com.benmu.framework.manager.impl.PushManager.getParams(bean, true));
finish();
}
}
break;
}
}
use of com.benmu.framework.model.NotificationBean in project WeexErosFramework by bmfe.
the class PushManager method handlePush.
public void handlePush(Context context, String data) {
// 判断当前应用是在前台还是后台
boolean isForeground = BaseCommonUtil.isAPPRunningForeground(context);
ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
NotificationBean bean = parseManager.parseObject(data, NotificationBean.class);
if (isForeground) {
// 在前台 通知js
Activity activity = RouterTracker.peekActivity();
if (activity instanceof AbstractWeexActivity) {
WXSDKInstance instance = ((AbstractWeexActivity) activity).getWXSDkInstance();
GlobalEventManager.pushMessage(instance, getParams(bean, false));
}
} else {
// 在后台 显示通知
showNotification(context, bean);
}
}
Aggregations