안녕하세요.
gcm 알림창 테스트 중 이상동작이 발생하여 찾아보는데 해결책이 떠오르지 않아 글남깁니다^^;
상황.
앱실행-> 홈버튼->gcm 메시지 수신-> 팝업뷰 호출 ( 이때 홈화면에서 알림이 뜨는게 아니라 마지막에 홈버튼 눌렀을때의 액티비리를 같이 호출해 줍니다...;)
GCM 메시지 받는 부분( 팝업뷰 호출. )
Intent popupIntent = new Intent(getBaseContext(), DisplayPopup.class)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TOP
);
popupIntent.putExtra("MSG", message);
popupIntent.putExtra("MSG_ID", message_id);
startActivity(popupIntent);
팝업뷰 (dailog로 내용 나타냄)
public class DisplayPopup extends Activity {
private DisplayPopupDialog mDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
// //화면 잠겨 있을때 보여주기
getWindow().addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
mDialog = new DisplayPopupDialog(this, getIntent()
.getStringExtra("MSG"), listener);
mDialog.show();
}
다이얼로그 부분
public class DisplayPopupDialog extends Dialog {
/**
* @uml.property name="message"
*/
private String message;
/**
* @uml.property name="tv_message"
* @uml.associationEnd
*/
private TextView tv_message;
private View.OnClickListener listenter;
Button btn_ok, btn_cancel;
public DisplayPopupDialog(Activity act, String message,
View.OnClickListener listenter) {
super(act);
this.message = message;
this.listenter = listenter;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new ContextThemeWrapper(getContext(), android.R.style.Theme_Translucent_NoTitleBar);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
setContentView(R.layout.display_popup1);
}
}
여기저기 찾아보니
투명액티비티? 에 다이얼로그를 띄우면 문제없이 된다고 하던데 왜 안될까요..;;;
단순히 팝업뷰만 호출을 해주는데 왜 마지막 액티비티가 같이 딸려오는지 ;;
추가로 앱을 종료 했을때는 이상없이 홈화면위에 제대로 표시 됩니다.
조그마한 조언이라두 감사합니다^^