2017-04-16 6 views
0

Android에서 알림 아래의 "잠금 화면에 제어 알림"설정이 있으며 알림의 공개 여부를 설정할 수 있습니다. notification Tutorial에 설명되어 있습니다.설정 상태 가져 오기 : "잠금 화면에서 알림 제어"

내 queston이 다음 설정의 상태를 얻을 수 있습니까?

내가 설정의 상태를 좋게하는 이유는 콘텐츠 숨기기를 사용하도록 설정 한 경우 사용자에게 더 많은 옵션을 제공하고 그렇지 않은 경우에는 방해하지 않기 때문입니다.

답변

0

예, 가능합니다. 그러나

Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS = "lock_screen_allow_private_notifications" 
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS = "lock_screen_show_notifications" 

이 값은 공개 API의 일부가 아니기 때문에, 그들은 미래에 변경 될 수 있습니다, 또는 모든 장치에서 작동하지 않을 수 있습니다, 두 상수가 있습니다.

int show_all = Settings.Secure.getInt(getContentResolver(), "lock_screen_allow_private_notifications", -1); 
int noti_enabled = Settings.Secure.getInt(getContentResolver(), "lock_screen_show_notifications", -1); 

if(show_all > 0 && noti_enabled > 0){ 
    // Post notification 
    // ... 
}