1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
private void connectPush(String title, String text) {
 
        NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
                .setContentTitle("난제목이야")     //기어핏에 나타낼 제목
                .setContentText("난내용이구")       //기어핏에 나타낼 내용
//                .setTicker("one line msg.")
                .setSmallIcon(R.mipmap.ic_launcher)     //기어핏에 나타낼 AppIcon
                .setAutoCancel(true)
                .setWhen(System.currentTimeMillis())
                .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS);
 
        Notification n = builder.build();
        n.defaults = Notification.DEFAULT_LIGHTS;   //디바이스 진동 없애기.
        nm.notify(1000, n);
    }
cs


다른 카테고리의 글 목록

개발 Story/안드로이드 카테고리의 포스트를 톺아봅니다