三星运行Android的设备序列号 [英] Serial number from Samsung Device running Android

查看:273
本文介绍了三星运行Android的设备序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个三星Galaxy Tab 2.0(7)

在该装置的背面是格式的序列号

RF3C6000MNA

当我进入我的设备上设置,选择关于设备 - >状态 - >序列号,也显示此号码。

我可以没有,但是,找到编程提取此号码的方式。

我已经看到了有关提取的序列号文章负载,但这会返回一个完全不同的数字。 (使用android.os.Build.SERIAL)

我已经提取的IMEI和MAC地址,所以我不需要code这一点。

解决方案

 公共静态字符串getManufacturerSerialNumber(){
  串系列= NULL;
  尝试 {
      类<> C =的Class.forName(android.os.SystemProperties);
      方法获取= c.getMethod(得,为String.class,为String.class);
      串行=(字符串)get.invoke(C,ril.serialnumber,未知);
  }赶上(异常忽略){}
  返回序列;
}
 

编辑:它已经因为这个答案了一段时间,这里的一对夫妇的更新点:

  • 在该任择议定书问的Galaxy Tab 2 并为确实的答案被 ril.serialnumber (即使对于非3G机型 - 见这要点)。据人士Himanshu的回答 Galaxy Tab的3 使用 sys.serialnumber (也支持通过的这个答案)。 sys.serialnumber 使得平板电脑为重组自交系更有意义。* 代表的无线接口层的,这是大多数平板电脑都没有配备( ril.serialnumber ,分别使得手机更有意义)。
  • 有获取设备序列号(即包装上的序列号没有标准的API - 不要混淆 Settings.Secure.ANDROID_ID 或其他各种独一无二分散在整个API标识符)。这意味着它是由制造商来决定存储设备的序列(如果有的话)。在 S3迷你 ril.serialnumber ,在的NexusOne ro.serialno 要点),在的Galaxy Tab 2 ril.serialnumber ,在 Galaxy Tab的3/4 sys.serialnumber ,在联想标签是<一个href="http://stackoverflow.com/questions/23773975/how-to-get-real-serial-number-of-lenovo-tab-in-android">none上述。这些设置似乎是秋后算账,看时为设备的序列,但不应该被认为是理所当然的,因此,不应该依赖于跟踪独特的应用程序的安装。

I have a Samsung Galaxy Tab 2.0 (7")

On the back of this device is a serial number of the format

RF3C6000MNA

When I go into settings on my device, and choose About Device->Status->Serial Number, this number also appears.

I can't, however, find a way of extracting this number programmatically.

I've seen loads of articles about extracting the serial number, but this returns a completely different number. (using android.os.Build.SERIAL)

I've already extracted the IMEI, and MAC address, so I don't need code for this.

解决方案

public static String getManufacturerSerialNumber() {
  String serial = null; 
  try {
      Class<?> c = Class.forName("android.os.SystemProperties");
      Method get = c.getMethod("get", String.class, String.class);
      serial = (String) get.invoke(c, "ril.serialnumber", "unknown");
  } catch (Exception ignored) {}
  return serial;
}

Edit: it's been a while since this answer, here's a couple of updated points:

  • The OP asked about Galaxy Tab 2 and for that indeed the answer was ril.serialnumber (even for the non-3G model - see this gist). According to Himanshu's answer Galaxy Tab 3 uses sys.serialnumber (also backed by this answer). sys.serialnumber makes better sense for tablets as ril.* stands for Radio Interface Layer, something most tablets are not equipped with (ril.serialnumber, respectively, makes better sense for phones).
  • There is no standard API for getting the device serial number (ie the serial number on the packaging - not to be confused with Settings.Secure.ANDROID_ID or the various other "unique" identifiers scattered throughout the API). This means it is up to the manufacturer to decide where to store the device serial (if at all). On the S3 Mini it's ril.serialnumber, on NexusOne it's ro.serialno (gist), on Galaxy Tab 2 it's ril.serialnumber, on Galaxy Tab 3/4 it's sys.serialnumber, on Lenovo Tab it's none of the above. These settings appear to be the usual suspects, when looking for the device serial, but shouldn't be taken for granted, and as such, shouldn't be relied on for tracking unique app installations.

这篇关于三星运行Android的设备序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆