언어 설정

Menu
Sites
Language
API to turn on/off mobile data

Is there any API exposed on native side to turn on/off mobile data programatically. Also, I would like to get the current status of mobile data connection which I think can be achieved by "    connection_get_cellular_state" .PLease correct me if I am wrong.

Responses

5 댓글
daniel kim

Hi,

There is a Native API which can get the status of mobile network like as below.

But I couldn't find the API which can change the status itself.

 

https://developer.tizen.org/dev-guide/2.3.0/ --> Tizen Mobile Native App Programming > Tutorials > Network Tutorials

 

connection_cellular_state_e cellular_state;
connection_get_cellular_state(connection, &cellular_state);
switch (cellular_state)
{
   case CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE:
      dlog_print(DLOG_INFO, LOG_TAG, "Out of service");
      break;
   case CONNECTION_CELLULAR_STATE_FLIGHT_MODE:
      dlog_print(DLOG_INFO, LOG_TAG, "Flight mode");  
      break;
   case CONNECTION_CELLULAR_STATE_ROAMING_OFF:
      dlog_print(DLOG_INFO, LOG_TAG, "Roaming is turned off");
      break;
   case CONNECTION_CELLULAR_STATE_CALL_ONLY_AVAILABLE:
      dlog_print(DLOG_INFO, LOG_TAG, "Call only");
      break;
   case CONNECTION_CELLULAR_STATE_AVAILABLE:
      dlog_print(DLOG_INFO, LOG_TAG, "Available");
      break;
   case CONNECTION_CELLULAR_STATE_CONNECTED:
      dlog_print(DLOG_INFO, LOG_TAG, "Connected");
      break;
   default:
      dlog_print(DLOG_INFO, LOG_TAG, "error");
      break;
}

I wish this will help you.

Alex Ashirov

Hi,

Probably you need to use connection_open_profile() and connection_close_profile() in order to establish/close connections.

Sumit Kumar

Hi,

I can still see data connection active even if i do connection_close_profile. I am not sure what exactly is achieved by connection close profile ,API description also is not very clear. Could you please guide.

Alex Ashirov

Hi,

Actually, it was just my assumption that this API can help. I have not used it before. But it seems that there is no API to turn off mobile data. It’s strange, because there is such API for wifi connection.

irfan abdul

Hi

Api to turn on mobile data - system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED,true);

API to off mobile data - system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED,false);

Use. systemsettings.admin privilige for accessing the api.

Thank you

Regards

irfan