BroadcastReceiver 나  Service 등과 같이 Activity 가 아닌 곳에서

실제 Activity의 context 를 가지고서  startActivity 등의 행동을 하기 위해서는  그냥 Intent를 만들어 전달하는 것이 아니라,   PendingIntent를 이용해야만 한다.


   Intent i = new Intent( context , PurposeActivity.class);
   PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_ONE_SHOT );

   try {
        pi.send();
   } catch( Exception e ) {}

 와 같이 하면  할 수 있다.
Posted by LucidasH

블로그 이미지
LucidasH

공지사항

Yesterday
Today
Total

달력

 « |  » 2025.2
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28

최근에 올라온 글

최근에 달린 댓글

글 보관함