Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8277269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:38:29+00:00 2026-06-08T08:38:29+00:00

I’m working in Android, writing some JNI code, and I’m looking for a way

  • 0

I’m working in Android, writing some JNI code, and I’m looking for a way to query the Mobile Equipment Identifier (MEID) from the device.

http://en.wikipedia.org/wiki/Mobile_equipment_identifier

I’m trying to write C or C++ code that can run by itself on an Android device, so I don’t think I can use Java (i.e., get MEID from TelephonyManager).

A search of StackOverflow finds: Is there an android shell or adb command that I could use to get a device's IMEI/MEID?

Okay great, dumpsys iphonesubinfo can get the info I need. And it works!

I couldn’t find the source for dumpsys except as part of the source for Android. So I downloaded that… my hard disk filled up before the download finished, but I did get the source code to dumpsys. It is a surprisingly short C++ file. All it does is query Android’s IBinder interface.

So, my questions:

0) Is there any way I can write a query against IBinder using just the stuff in the NDK? The include files used by dumpsys.cpp are not in the NDK, and grep in the NDK directory didn’t find IBinder in any include files or code samples, so my guess is “no” (but I would like to be wrong).

1) Is there any other good way to get the MEID?

I’m seriously thinking I should just use system("dumpsys iphonesubinfo > /tmp/myprogname_dumpsys.tmp" and then open the resulting file and parse it. That should work, but I would hardly call it elegant… and I’m not sure if dumpsys is available on every Android device or not.

EDIT: The idea of using system() to run dumpsys will not work, because dumpsys needs android.permission.DUMP and Android no longer allows non-system apps to have that permission.

Dumpsys permission denial in java

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:38:31+00:00Added an answer on June 8, 2026 at 8:38 am

    I believe Dalvik implements all the same JNI interfaces that the JVM does, so while it’s a bit fiddly, it’s perfectly possible to make calls from native code through JNI to arbitrary Java classes and methods.

    /* assuming you already have */
    JNIEnv *env;
    jobject context;
    /* then call (with error-checking) */
    jclass cls = (*env)->FindClass(env, "android/context/Context");
    jmethodId mid = (*env)->GetMethodID(env, context_cls, "getSystemService",
        "(Ljava/lang/String;)Ljava/lang/Object;");
    jfieldID fid = (*env)->GetStaticFieldID(env, cls, "TELEPHONY_SERVICE",
        "Ljava/lang/String;");
    jstring str = (*env)->GetStaticObjectField(env, cls, fid);
    jobject telephony = (*env)->CallObjectMethod(env, context, mid, str);
    cls = (*env)->FindClass(env, "android/telephony/TelephonyManager");
    mid =(*env)->GetMethodID(env, cls, "getDeviceId", "()Ljava/lang/String;");
    str = (*env)->CallObjectMethod(env, telephony, mid);
    jsize len = (*env)->GetStringUTFLength(env, str);
    char* deviceId = calloc(len + 1, 1);
    (*env)->GetStringUTFRegion(env, str, 0, len, deviceId);
    (*env)->DeleteLocalRef(env, str);
    /* to get a string in deviceId */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.