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

notification 자기화면 띄우기 [closed]

0 추천

제가 타이머 작동중에 activity를 벗어나면 notification을 띄워 타이머 작동을 제어하고 notification 클릭시 다시 그 activity로 돌아오기 위해 

Intent notification_intent = new Intent(context, ActivityLoding.class);
            notification_intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            notification_intent.setAction(Intent.ACTION_MAIN);
            notification_intent.addCategory(Intent.CATEGORY_LAUNCHER);

            notification_intent.putExtra("id", getIntent().getExtras().getInt("id"));
            PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notification_intent, 0);

            builder = new Notification.Builder(context);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                builder.setSmallIcon(R.drawable.ready)
                        .setAutoCancel(true)
                        .setOngoing(true)
                        .setCustomContentView(remoteViews)
                        .setContentIntent(pendingIntent);
            } else {
                builder.setSmallIcon(R.drawable.ready)
                        .setAutoCancel(true)
                        .setOngoing(true)
                        .setContent(remoteViews)
                        .setContentIntent(pendingIntent);
            }

다음과 같이 하고 안드로이드스튜디오에서 usb잭연결해서 폰에 받았을때는 잘 실행되었습니다.

그런데 apk를 만들어 구글플레이스토어에 올린뒤 받아서 실행하니 자기 activity화면으로 돌아가는게 아니라

그냥 새로 어플이 실행이 되었습니다. 코드가 문제라기에는 안드로이드스튜디오에서 바로 제폰에 받았을떄는 원하는대로 동작이 하여서 이상합니다.

바로받는것과 저코드 그대로 apk파일생성 후 플레이스토어에서 받아 하는것과 차이가 있나요?

질문을 종료한 이유: 여기 보고 해결했습니다. https://stackoverflow.com/questions/4341600/how-to-prevent-multiple-instances-of-an-activity-when-it-is-launched-with-differ/
WoowK (180 포인트) 님이 2018년 2월 15일 질문
WoowK님이 2018년 2월 17일 closed
...