마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 노티 gcm 문제

0 추천

안녕하세요 안드로이드펍 가족님들..

노티 관련해서 질문드릴려고합니다.

제가 하고싶은것은

 

노티가 왔을대 해당앱이 실행중일때는 노티를 눌러도 아무반응이없고요

노티가 왓는대 해당앱이 실행중일때가 아니면 해당앱이 실행 되었으면 합니다.

 

그런데 여기서 문제가 앱이 실행중일때 노티가 왔는데 앱을꺼버리고 노티를 눌러버릴때는 앱이 실행이 안되는문제가 있는데요.

 

어떻게 해야하나요 ㅜㅜ

 

public void showNotification(final Context context, Intent intent,

String strMsg, boolean deeplink) {

 

PendingIntent myRunIntent = getRunIntent(context, intent);

NotificationManager mNotificationManager = (NotificationManager) context

.getSystemService(Context.NOTIFICATION_SERVICE);

 

Notification notification = new Notification();

 

PendingIntent myDelIntent = getDeleteIntent(context, intent);

 

// auto-cancel flag 를 설정한다.

notification.flags |= Notification.FLAG_AUTO_CANCEL;

 

// audio stream to ring 을 설정한다.

notification.audioStreamType = Notification.STREAM_DEFAULT;

 

notification.deleteIntent = myDelIntent;

 

notification.icon = R.drawable.ic_launcher;

notification.tickerText = strMsg;

notification.when = System.currentTimeMillis();

 

if(deeplink)

notification.setLatestEventInfo(context, "알림", strMsg, myRunIntent);

else

notification.setLatestEventInfo(context, "알림", strMsg, null);

 

// notification.setLatestEventInfo(context, "알림", strMsg, myRunIntent);

 

 

mNotificationManager.notify(context.getString(R.string.app_name), 0,

notification);

}

 

final PendingIntent getRunIntent(Context context, Intent intent) {

 

Intent notificationIntent = new Intent(context, SplashActivity.class);

PendingIntent myIntent = PendingIntent.getActivity(context, 0,

notificationIntent, 0);

 

return myIntent;

}

 

 

 

흠바바 1 (4,000 포인트) 님이 2014년 5월 23일 질문
SplashActivity 이 친구가 실행중이면 안띄우고 실행중이 아니라면 띄우겠다는 거죠??
그냥 앱이 실행중이면 띄우고 아니면 안띄우는거죠^^

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...