0

I have privileges and permission for telephony services. I am trying to retrieve IMEI and cell_id and other numbers. I am testing on emulator.

Code:

char *imei;
/* In the case of a single SIM, you get only one handle */

ret = telephony_init(&handle_list);
if (ret == TELEPHONY_ERROR_NONE) {

    for (i = 0; i < handle_list.count; i++) {

        snprintf(chars, sizeof(chars),
                "<br>telephony handle[%p] for subscription[%d]",
                handle_list.handle[i], i);

        ret = telephony_modem_get_imei(handle_list.handle[i], &imei);
        if (ret == TELEPHONY_ERROR_NONE) {
            dlog_print(DLOG_INFO, LOG_TAG, "imei: %s", imei);
            snprintf(chars, sizeof(chars), "<br>imei: %s", imei);
        } else {
            snprintf(chars, sizeof(chars),
                    "<br>imei: getting error.Code: %d", ret); // I am getting this error always. How to resolve?
        }

    }

How to successfully retrieve device IMEI number?

Rifat
  • 1,700
  • 3
  • 20
  • 51

1 Answers1

1

Could you let us know your privilege and its level?

For getting proper IMEI via telephony API,

Application should have "http://tizen.org/privilege/securesysteminfo" and its level is partner among public(3rd party)/partner(2nd party)/platform(manufacturer).

Please refer the updated telephony API doxygen as following link.

https://developer.tizen.org/development/api-references/native-application?redirect=https://developer.tizen.org/dev-guide/5.5.0/org.tizen.native.mobile.apireference/group__CAPI__TELEPHONY__INFORMATION__MODEM.html

https://developer.tizen.org/development/api-references/native-application?redirect=https://developer.tizen.org/dev-guide/5.5.0/org.tizen.native.mobile.apireference/group__CAPI__TELEPHONY__INFORMATION__MODEM.html#ga7e0c134af4fe12c9074f5feaccf9f5cc

Lunch Basketball
  • 432
  • 6
  • 10
  • Thank you for your valuable answer. I noticed on updated doc there is warning that it can not be used by third party apps. My application requires an unique number for server to keep track of information that user can retrieve and change when needed with user consent. It does not keep user data. So can you please tell me how I can achieve this privilege on a second party level or to the level that can retrieve IMEI? Also what can be alternative to the usage of IMEI for unique device ID? – Rifat Apr 08 '20 at 08:09
  • 1
    Probably, DUID (device unique identification) could be used for Gear device. Could you check it? #include char* value = NULL; system_info_get_platform_string("http://tizen.org/system/tizenid", &value); free(value); – Lunch Basketball Apr 09 '20 at 02:47
  • Awesome. Thanks a lot. I will use this and I hope this will be sufficient for my purpose. – Rifat Apr 09 '20 at 11:51
  • Hello @Lunch Basketball, I'm able to retrieve DUID with your code on emulator without any issue but I can not get DUID on tizen watch running tizen API v-4.0. It says an error msg on log: `system_info.c: db_get_value(145) > Failed to find key (tizen.org/system/tizenid, string)` . What can I do for this? Also it says telephony service feature is diabled. I have telephony priviledge. Please give me a solution. – Rifat Apr 17 '20 at 16:25
  • Great to hear. Thank you for trying. – Rifat Apr 21 '20 at 07:55
  • Hi, have you found any solution? – Rifat Apr 23 '20 at 13:49
  • 1
    This old topic could help you..... I hope so. https://stackoverflow.com/questions/40058680/how-to-get-duid-on-tizen-tablet/40071954#40071954 – Lunch Basketball May 22 '20 at 07:15