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

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

BY 08 Feb 2017 Native Application Development

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.

Written by