I'm trying to develop a service app which should listen to a change in the network name and then emit some kind of event to the some front end app. Since I have no access to a physical device (wearable - for my particular case) I was wondering if there is any way I can test my code from within the emulator. I need to some how change the network name in order to see if the event I wrote is triggered correctly. I will appreciate any advice, thanks.
3 Answers
You need to use following Telephony API. You can register notification callback using below API.
int telephony_set_noti_cb (telephony_h handle,
telephony_noti_e noti_id,
telephony_noti_cb cb,
void * user_data
)
Telephony Handle(Struct) - telephony_h
Type of Notification - telephony_noti_e
Notification Callback - telephony_noti_cb
For more info check here

- 1,719
- 13
- 22
Tizen emulator has control panel and can control event(sms, call, battery level, sensor input and so on). But, There is no information about network status like cellid except RSSI level in mobile emulator.
In case of mobile application, You can use telephony_set_noti_cb with TELEPHONY_NOTI_NETWORK_SIGNALSTRENGTH_LEVEL, and you can test with emulator RSSI level.
After that you need to change TELEPHONY_NOTI_NETWORK_CELLID before make real app for target.

- 71
- 5
As answered already, The control panel on Tizen emulator has no option for 'Network name'. And network name on Emulator is fixed with 'SDK' charactor and would not be changed manually.
Please find below sample code, and I hope it would be helpful.
This code just print a log when network name is changed and tested on a physical device (with mobile device, but it has same usage with wearable device).
#include <tizen.h>
#include <service_app.h>
#include <telephony.h>
#include "test-service.h" // Auto-generated header file with IDE
typedef struct {
telephony_handle_list_s handle_list;
} AppData;
void
network_name_changed_noti_cb(telephony_h handle, telephony_noti_e noti_id, void *data, void* user_data)
{
const char *network_name = (const char*)data;
dlog_print(DLOG_INFO, "TEST", "Network Name: [%s]", network_name);
}
bool service_app_create(void *data)
{
AppData *app_data = (AppData*)data;
telephony_error_e ret;
int i = 0;
if (!app_data) {
dlog_print(DLOG_ERROR, "TEST", "Failed to get AppData !");
return false;
}
/* Initialize telephony */
ret = telephony_init(&app_data->handle_list); // In case of single SIM, you get only one handle
if (ret != TELEPHONY_ERROR_NONE) {
dlog_print(DLOG_ERROR, "TEST", "Failed to initialize telephony !");
return false;
}
for (i = 0; i < app_data->handle_list.count; i++) {
dlog_print(DLOG_INFO, "TEST", "telephony handle[%p] for subscription[%d]",
app_data->handle_list.handle[i], i);
}
/* Register notification callback for network name change event */
ret = telephony_set_noti_cb(app_data->handle_list.handle[0], TELEPHONY_NOTI_NETWORK_NETWORK_NAME,
network_name_changed_noti_cb, &app_data);
if (ret != TELEPHONY_ERROR_NONE) {
dlog_print(DLOG_ERROR, "TEST", "Failed to register callback !");
}
return true;
}
/*
* Auto-generated functions(from Tizen IDE) are not included
*/
int main(int argc, char* argv[])
{
AppData app_data; // Store telephony handle here
service_app_lifecycle_callback_s event_callback;
app_event_handler_h handlers[5] = {NULL, };
event_callback.create = service_app_create;
event_callback.terminate = service_app_terminate;
event_callback.app_control = service_app_control;
service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &app_data);
service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &app_data);
service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &app_data);
service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &app_data);
// Set 'AppData' as a user_data
return service_app_main(argc, argv, &event_callback, &app_data);
}

- 11
- 2