Page 928 - 3-2
P. 928
// autoCancel: 한번 누르면 알림바에서 사라진다.
textAl = " 불남";
detector = "1";
addr = notAddr[0];
room = notRoom[0];
fire = notFire[0];
spark = notSpark[0];
gas = notGas[0];
temp = notTemp[0];
listItem.add(new ListItem(detector, addr, room, fire,
spark, gas, temp));
Log.d(this.getClass().getName(),
("1 번: " + addr + " 호"));
Intent intent = new Intent(getApplicationContext(),
MainActivity.class);
PendingIntent pIntent =
PendingIntent.getActivity(getApplicationContext()
, 0
, intent
, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pIntent);
manager.notify(1, builder.build());
}
if(notFire[1].equals("1")) {
NotificationManager manager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
NotificationCompat.Builder builder = new
NotificationCompat.Builder(getApplicationContext());
builder.setSmallIcon(R.drawable.on)
.setTicker("HETT")
.setContentTitle(notAddr[1]+" 호 "+disRoom[1]+
" 에서 불이났습니다!")
.setContentText(" 도망가세요!")
.setDefaults(Notification.DEFAULT_SOUND |
Notification.DEFAULT_LIGHTS |
Notification.DEFAULT_VIBRATE)
.setAutoCancel(true); // 알림바에서 자동 삭제
// autoCancel: 한번 누르면 알림바에서 사라진다.
textAl = " 불남";
detector = "2";
addr = notAddr[1];
room = notRoom[1];
fire = notFire[1];
- 928 -