Most of Users are not devloper. For any reason, their devices are enabled for “Don’t keep activities”option in developer option.

if device is enabled, the activity manager will aggressively finish activities and
processes as soon as they are no longer needed. accordingly, some functions may not work.

The following code snippet shows how you can detect your app’s the option enabled

public boolean isAlwaysFinishActivitiesEnabled(){
    int state;
    
    if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1){
        state = Settings.System.getInt(
                getContentResolver(),
                Settings.System.ALWAYS_FINISH_ACTIVITIES,  
                0
        );
    }else{
        state = Settings.Global.getInt(
                getContentResolver(),
                Settings.Global.ALWAYS_FINISH_ACTIVITIES, 
                0
        );
    }
    return state != 0;
}
카테고리: 미분류

0개의 댓글

답글 남기기

Avatar placeholder

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다.