display alarm notification
This commit is contained in:
parent
1299ff2d2e
commit
5c075ee168
@ -1688,64 +1688,63 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
|
||||
SM.Debug("Unit imei:" + tempArr[0]);
|
||||
String unitIMEI = tempArr[0];
|
||||
|
||||
|
||||
// change Visual Elements
|
||||
setImei(unitIMEI);
|
||||
switch (msg.opCode) {
|
||||
case 135:
|
||||
setMess("speed " + tempArr[1]);
|
||||
break;
|
||||
case 136:
|
||||
setMess("landmark " + tempArr[1]);
|
||||
break;
|
||||
case 137:
|
||||
setMess("zone " + tempArr[1]);
|
||||
break;
|
||||
case 140:
|
||||
setMess("telemetry " + tempArr[1]);
|
||||
break;
|
||||
default:
|
||||
// 138
|
||||
setMess("emergency");
|
||||
}
|
||||
myHandler.post(updateResultsAlarm);
|
||||
|
||||
if ((msg.opCode == 138) && (AppParams.crtTab == AppParams.Tabs.live)) {
|
||||
SuperVehicle superVehicle = getSuperVehHash().get(Long.parseLong(unitIMEI));
|
||||
|
||||
if (superVehicle != null) {
|
||||
//if is not check i need to force check to put on the map
|
||||
boolean forceChecked = false;
|
||||
if (!superVehicle.needUpdate) {
|
||||
superVehicle.needUpdate = true;
|
||||
forceChecked = true;
|
||||
}
|
||||
try {
|
||||
int x = 0;
|
||||
if (forceChecked) {
|
||||
for (Vehicle veh : getAllVehicle()) {
|
||||
if (veh.imei.compareTo(unitIMEI) == 0) break;
|
||||
x++;
|
||||
}
|
||||
} else x = -1;
|
||||
if (getLiveActivity() != null) {
|
||||
if (x != getAllVehicle().size())
|
||||
getLiveActivity().emergencyAlarmReceived(x, superVehicle.lat, superVehicle.lng);
|
||||
else
|
||||
getLiveActivity().emergencyAlarmReceived(-1, superVehicle.lat, superVehicle.lng);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
SM.Debug(HASH_ERROR_MESSAGE + ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//list for SMS
|
||||
if (AppParams.crtTab == AppParams.Tabs.alarms) {
|
||||
SM.Debug("currentActivity instanceof AlarmActivity - newSMS | " + tempArr[0] + " | " + tempArr[1]);
|
||||
getAlarms(AppParams.USERID);
|
||||
}
|
||||
// if tab is not TextTab
|
||||
if (tabHost.getCurrentTab() != 5) {
|
||||
// change Visual Elements
|
||||
setImei(unitIMEI);
|
||||
switch (msg.opCode) {
|
||||
case 135:
|
||||
setMess("speed " + tempArr[1]);
|
||||
break;
|
||||
case 136:
|
||||
setMess("landmark " + tempArr[1]);
|
||||
break;
|
||||
case 137:
|
||||
setMess("zone " + tempArr[1]);
|
||||
break;
|
||||
case 140:
|
||||
setMess("telemetry " + tempArr[1]);
|
||||
break;
|
||||
default:
|
||||
// 138
|
||||
setMess("emergency");
|
||||
}
|
||||
myHandler.post(updateResultsAlarm);
|
||||
|
||||
if ((msg.opCode == 138) && (AppParams.crtTab == AppParams.Tabs.live)) {
|
||||
SuperVehicle superVehicle = getSuperVehHash().get(Long.parseLong(unitIMEI));
|
||||
|
||||
if (superVehicle != null) {
|
||||
//if is not check i need to force check to put on the map
|
||||
boolean forceChecked = false;
|
||||
if (!superVehicle.needUpdate) {
|
||||
superVehicle.needUpdate = true;
|
||||
forceChecked = true;
|
||||
}
|
||||
try {
|
||||
int x = 0;
|
||||
if (forceChecked) {
|
||||
for (Vehicle veh : getAllVehicle()) {
|
||||
if (veh.imei.compareTo(unitIMEI) == 0) break;
|
||||
x++;
|
||||
}
|
||||
} else x = -1;
|
||||
if (getLiveActivity() != null) {
|
||||
if (x != getAllVehicle().size())
|
||||
getLiveActivity().emergencyAlarmReceived(x, superVehicle.lat, superVehicle.lng);
|
||||
else
|
||||
getLiveActivity().emergencyAlarmReceived(-1, superVehicle.lat, superVehicle.lng);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
SM.Debug(HASH_ERROR_MESSAGE + ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2052,7 +2051,6 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
|
||||
.setAutoCancel(true)
|
||||
.setContentIntent(pendingIntent);
|
||||
|
||||
Log.v("test111", "test");
|
||||
NotificationManagerCompat managerCompat = NotificationManagerCompat.from(context);
|
||||
managerCompat.notify(icon, builder.build());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user