Page 482 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 482
return super.onStartCommand(intent, flags, startld);
}
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
NotificationManager manager =
( N o t i f i c a t i o n M a n a g e r )
getSystemService(NOTIFICATION_SERVICE);
NotificationCompat.Builder builder =
new NotificationCompat.Builder(NotificationService.this);
builder.setSmallIcon(R.drawable.a)
.setTicker("※자전거가 도난되었습니다!※")
.setContentTitle("자전거 잠금")
.setContentText("※자전거가 도난되었습니다!※")
.setDefaults(Notification.DEFAULT_SOUND |
Notification.DEFAULT_LIGHTS)
.setAutoCancel(true); // 알림바에서 자동 삭제
// autoCancel : 한번 누르면 알림바에서 사라진다.
// 알람 클릭시 LockActivity를 화면에 띄운다.
Intent intent = new Intent(getApplicationContext(),
LockActivity.class);
PendingIntent pIntent =
PendingIntent.getActivity(getApplicationContext()
, 0
, intent
, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pIntent);
manager.notify(1, builder.build());
sig = 0;
}
;
- 475 -