2

작은 팝업 상자로 앱 외부에 알람을 설정하려고합니다. Activity.I를 사용하여 팝업 상자를 만들었습니다. 오랜 시간 동안 알람 앱처럼 알람을 설정하려고했지만 일부 상황에서는 실패했습니다.알람 설정 방법 Android의 알람 앱과 동일?

뒤로 버튼을 사용하여 시작 활동에서 앱을 종료하면 성공합니다.

그러나 홈 버튼을 누르면 알람이 계속 작동하지만 백그라운드에서 마지막으로 사용한 작업이 계속됩니다.

나는 왜 이런 일이 일어 났는지 모르겠다. 집에있는 버튼을 눌렀을 때 나는 백그라운드에서 어떤 활동도하지 않고 어떻게이 일을 할 수 있는지 알고 싶다.

내 온 리시버 코드입니다. 너희들이 멋진 것 실제 알람 응용 프로그램 코드에 대한 링크를 제공하는 경우

@Override 
public void onReceive(Context context, Intent intent) { 


    try { 
     Bundle bundle = intent.getExtras(); 
     String message = bundle.getString("alarm_message"); 

     Intent newIntent = new Intent(context, ReminderPopupMessage.class); 
     newIntent.putExtra("alarm_message", message); 
     newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
     newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
     context.startActivity(newIntent); 
     } catch (Exception e) { 
     e.printStackTrace(); 

     } 
} 

}

.

도움 주셔서 감사합니다.

답변

1

내 다른 답변에 모습을 가지고있다.

<activity android:name=".AlarmPopup" android:theme="@android:style/Theme.Dialog" 
      android:clearTaskOnLaunch="true" android:launchMode="singleInstance" 
      android:finishOnTaskLaunch="true" excludeFromRecents="true"/> 

문제가 해결되었습니다.

누군가에게 도움이되기를 바랍니다.

0

예 실제로 Android 알람 앱 here의 src를 다운로드해야합니다.

내가 그냥 안드로이드 팝업 클래스 매니페스트 파일이 추가 시간이 오래

후 답을 발견 here

+0

감사합니다 Ankit .. 나는 그것을보고 당신에게 돌아올 것입니다 .. – GoCrazy