언어 설정

Menu
Sites
Language
How to detect if device is in DnD mode or a phone call is active on wearable?

I'm writing a hybrid applicaiton for tizen wearables using the 2.3.1 SDK. In service side off the app, I need to detect if device is locked or a phone call is active. And I have 2 questions.

  1. So far to detect if device is locked, I did (pseudocode);

LOCK_STATE     lockScreenAppPackageId = system_settings_get_value_string( SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP );
    if( lockScreenAppPackageId != NULL )
             isDeviceLocked =  app_manager_is_running( lockScreenAppPackageId );

which is working but I wonder if this is the right approach for this, is there any better way?

 

  2. I see there are 2 methods in sdk to detect call states; telephony_call_get_voice_call_state and telephony_call_get_video_call_state. I expect these methods will work for calls made on LTE enabled models but what I wonder is, if these methods can also detect call status on bluetooth only wearables ? If not how can I detect if there is a bluetooth redirected phone call active on watch?

 

EDIT:

I've just found out that SYSTEM_SETTINGS_KEY_LOCK_STATE exists at 2.3.1, I was looking at old SDK so questions 1 is resolved. But I have another question now. How to detect if device is in Do Not Disturb Mode SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE  is not working.

Edited by: Onur Şahin on 07 2월, 2017

Responses

2 댓글
Shaswati Saha

So far I know, there's no direct way to detect DND mode till now. But you may try a workaround though it's not that much good. FYI, screen remains turned off in DND mode. So, you may check both the screen state and the call state. If screen is in off state and the call state is in TELEPHONY_CALL_STATE_CONNECTING state, then you may take the decision that DND mode is active.

NOTE: The pitfall of this idea is, what decision should be taken if the device screen is already in on state and at that time there's an incoming call. 

Onur Şahin

As far as workarounds go, I can just invoke "vconftool get db/setting/blockmode_wearable" but I'm looking for a proper way.