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

푸쉬 메시지(노티피케이션)에서 WebView 특정 페이지로 이동

0 추천
GCM 푸쉬 메시지를 onMessage() 콜백 함수에서 받습니다.

노피티케이션을 통해 푸쉬 메시지를 표현하고요

그리고 보통 엑티비티로 이동시키는거까지가 기본 형태지요??

 

근데 특정 엑티비티 클래스로 이동하는게 아닌

WebView 에 특정 페이지로 이동시킬수도 있나요?

 

 

솔직히 말씀드리면

http://www.masterqna.com/android/43712/%EC%95%88%EB%85%95%ED%95%98%EC%84%B8%EC%9A%94-push-%EC%88%98%EC%8B%A0%EC%8B%9C-%ED%8E%98%EC%9D%B4%EC%A7%80-%EC%9D%B4%EB%8F%99-%EA%B4%80%EB%A0%A8-%EC%A7%88%EB%AC%B8-%EB%93%9C%EB%A6%BD%EB%8B%88%EB%8B%A4

여기 나오는거 보고 못따라하겠습니다

좀더 쉽고 자세하게 알려주시면 감사하겠습니다.
익명사용자 님이 2016년 3월 15일 질문

1개의 답변

0 추천
간단하게..putExtra  로 특정페이지 url담고

웹뷰 있는 class 에서 getIntent 로 putextra 통해 넘긴 url받아서 웹뷰.loadurl("putextra로 넘긴url") 해주면 될거같습니다.
sadeva (21,550 포인트) 님이 2016년 3월 15일 답변
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);

        Intent notificationIntent = new Intent(context, MainActivity.class);
        notificationIntent.putExtra("url", url);
         
//        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        PendingIntent pi = PendingIntent.getActivity(context, 100, notificationIntent, 0);
         
        notification.setLatestEventInfo(context, title, message, pi);
        notification.flags |= Notification.FLAG_AUTO_CANCEL;
        notificationManager.notify(0, notification);

로 하고

메인엑티비티에서
@Override
    protected void onActivityResult 함수에서

            String url = intent.getStringExtra("url");
            Toast.makeText(getApplicationContext(), "url : "+url, Toast.LENGTH_LONG).show();
            webView.loadUrl(url);

이런식으로 하고있는데 아예 이쪽 타지를 않네요... 뭐가 잘못된건지 도통..
oncreate 에서 url값 받아보세요~
계속 질문해서 죄송한데...

제가 올린 코드 틀린거없나요???

저런식으로 하고

onCreate에서 인텐트값을 어떻게 받죠??
Intent intent = new Intent();
        String url = intent.getStringExtra("url");
        Log.i(TAG, "url : "+url);
이렇게 할수밖에없는거같은데 이런식으로하면..... new해서 다른 객체잖아요?? ㅠㅠ
Intent intent = getIntent();
모나미님이 말씀하신대로 해보세영
모두 감사합니다.
좋은 하루되세요
...