안녕하세요 안드로이드펍 가족님들..
노티 관련해서 질문드릴려고합니다.
제가 하고싶은것은
노티가 왔을대 해당앱이 실행중일때는 노티를 눌러도 아무반응이없고요
노티가 왓는대 해당앱이 실행중일때가 아니면 해당앱이 실행 되었으면 합니다.
그런데 여기서 문제가 앱이 실행중일때 노티가 왔는데 앱을꺼버리고 노티를 눌러버릴때는 앱이 실행이 안되는문제가 있는데요.
어떻게 해야하나요 ㅜㅜ
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;
}