protected void validate() throws Exception { if (!CsTigoApplication.getGlobalParameterHelper().getDeviceEnabled()) { CsTigoApplication.vibrate(false); CsTigoApplication.showNotification( CSTigoNotificationID.SERVICE_UPDATE, CsTigoApplication.getContext().getString(R.string.disabled_device), CsTigoApplication.getContext().getString(R.string.disabled_device_desc), MainActivity.class); String messageIn = CsTigoApplication.getContext().getString(R.string.disabled_device_desc); MessageEntity messageEntity = new MessageEntity(); messageEntity.setEventDate(new Date()); messageEntity.setMessage(messageIn); messageEntity.setService(getServiceEntity()); messageEntity.setState(MessageState.RECEIVED.ordinal()); CsTigoApplication.getMessageHelper().insert(messageEntity); throw new Exception(""); } }
protected void notificate() { if ((getServiceEventEntity() == null) || (getServiceEventEntity() != null && getServiceEventEntity().getNotifyMessage())) { Integer title = event.getTitle(); Integer desc = event.getSuccessMessage(); if (getServiceEventEntity() == null) { desc = event.getErrorMessage(); } CsTigoApplication.vibrate(CsTigoApplication.getGlobalParameterHelper().getPlatformVibrate()); CsTigoApplication.showNotification( CSTigoNotificationID.SERVICE_UPDATE, CsTigoApplication.getContext().getString(title), CsTigoApplication.getContext().getString(desc), (getServiceEventEntity() != null && getServiceEventEntity().getActivityToOpen() != null ? getServiceEventEntity().getActivityToOpen() : MessageHistoryActivity.class)); } }