Languages

Menu
Sites
Language
How to check status of Z1 in mute, vibrate or ring?

Hello, I'm making simple game with Background music.

So checking phone status is in mute, vibrate or ring is important to pass valdiation test,

 

But I cannot find how to do it,

When I try to do it with the below code, it just determine it mute or not.

 

bool isSilent=false;
 system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, &isSilent);
 if (isSilent)
  dlog_print(DLOG_DEBUG, LOG_TAG, "silent mode");
 else
  dlog_print(DLOG_DEBUG, LOG_TAG, "no silent mode");

But actually, to contorl Background music on/off, vibrate mode must be considered as silent mode

 

Ring -> no silent

Vibrate -> no silent  (why?)

Mute -> silent

 

Is there someone who can findout ringtone status successfully?

 

Responses

2 Replies
Jean Yang

For vibrate, you can try the runtime_info_get_value_bool API to get if vibration enabled. The key RUNTIME_INFO_KEY_VIBRATION_ENABLED indicates whether vibration is enabled. Below are sample code.

#include <stdbool.h>
#include <runtime_info.h>
void func(void)
{
   bool value;
   int ret;

   ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_VIBRATION_ENABLED, &value);
   if (ret != RUNTIME_INFO_ERROR_NONE)
   {
      // Error handling
      return;
   }
   dlog_print(DLOG_INFO, LOG_TAG, "Vibration: %s", value ? "Enabled" : "Disabled");
}

pius lee

Silent mode is not defined exactly in document.

https://developer.tizen.org/development/guides/native-application/system/system-settings-0

In guide of system-settings, Silent mode is written as just "Indicates whether the device is in the silent mode."  

It means You can't know what volume is muted with SYSTEM_SETTINGS_KEY_SOUND_SLIENT_MODE.

I think if you want just sound status of each volume types (system, notification, media, alarm, voice) then you would be use SoundManager API.

Tutorial : https://developer.tizen.org/development/tutorials/native-application/multimedia/sound-manager

Guide : https://developer.tizen.org/development/guides/native-application/multimedia/sound-manager-0

API reference : https://developer.tizen.org/dev-guide/2.3.0/org.tizen.native.mobile.apireference/group__CAPI__MEDIA__SOUND__MANAGER__VOLUME__MODULE.html