2012. 8. 3. 22:48


 public void MessageCloass() {

// mValue++;
// mText.setText(Integer.toString(mValue));

mNotiManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

Notification noti = new Notification(R.drawable.ic_launcher,
"링크허브 메시지", System.currentTimeMillis());
noti.defaults |= Notification.DEFAULT_SOUND;
// 진동 사용
noti.defaults |= (Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
// 커스텀 진동
noti.vibrate = new long[] { 1000, 1000, 500, 500, 200, 200, 200, 200,
200, 200 };
noti.flags |= Notification.FLAG_INSISTENT;

Intent intent = new Intent(linkhub_main.this, linkhub_main.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent content = PendingIntent.getActivity(linkhub_main.this, 0,
intent, 0);
noti.setLatestEventInfo(linkhub_main.this, "링크허브 메시지", "메시지가 도착하였습니다.",content);

mNotiManager.notify(linkhub_main.NAPNOTI, noti);








 public void MessageCloass() {

// mValue++;
// mText.setText(Integer.toString(mValue));

mNotiManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

Notification noti = new Notification(R.drawable.ic_launcher,
"링크허브 메시지", System.currentTimeMillis());
noti.defaults |= Notification.DEFAULT_SOUND;
// 진동 사용
noti.defaults |= (Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
// 커스텀 진동
noti.vibrate = new long[] { 1000, 1000, 500, 500, 200, 200, 200, 200,
200, 200 };
noti.flags |= Notification.FLAG_INSISTENT;

//Intent intent = new Intent();
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// PendingIntent contentIntent = PendingIntent.getActivity(linkhub_main.this, 0, new Intent(this,linkhub_main.class),0);

// PendingIntent content = PendingIntent.getActivity(linkhub_main.this, 0, intent,0);
// startService(intent);
//noti.setLatestEventInfo(context, contentTitle, contentText, contentIntent)
noti.setLatestEventInfo(linkhub_main.this, "링크허브 메시지", "메시지가 도착하였습니다.", pendingIntent());
mNotiManager.notify(linkhub_main.NAPNOTI, noti);
}
public PendingIntent pendingIntent() {
Intent i = new Intent(getApplicationContext(), linkhub_main.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0);
cancelNotivication();
return pi;
}
public void cancelNotivication(){
mNotiManager.cancelAll();
}

Posted by k1rha