Categories
Android

Android设置显示本机号码

本机号码,我觉得是没有多大的用处,几乎谁都会知道自己的手机号码,但也有用户真的需要这个功能。有个对讲机软件tikl – touch to talk,可以通过网络进行多方通话,需要用到本机号码。 测试短信的脚本,自己给自己发短信,也需要本机号码。

Android手机在 设置-关于手机-状态消息,可以查看到本机号码,很多情况是显示未知。 很多模组用AT+CNUM 这组AT命令可以设置与查询本机号码。一般的手机在查看本机号码的界面都可以添加本机号码的,比如MTK/展信手机都提供这个功能。 Android对卡的操作,都是直接读写卡上的信息,用比较底层的AT+CRSM,而不是常用的AT,比如 AT+CMBR, AT+CMBW,AT+CNUM等。

Android手机设置本机号码,目前我还没发现有工具可以设置,很多人是把SIM卡拿到可以设置的手机上设置,然后把卡重新插上。 不过,Froyo提供了内部接口方法Phone.setLine1Number(),CM6的通话设置里就加入了本机号码设置功能:

具体的代码,在这里看清清楚楚:

http://github.com/CyanogenMod/android_packages_apps_Phone/commit/5351ce8247eb9fc9a3bf2ec751d14dcd373ab92e

可能需要到github注册个帐号,才可以浏览代码,主要是在phone里面添加处理,独立写个小程序的话,比较麻烦,因为要访问PhoneApp。

更新: (2010-11-15) 今天试了一下,参考Settings, 共享一个sharedUserId,也可以写个独立的程序,在g1 2.2,HTC desire上测试通过。注意:Android 2.2以下的无法使用。

代码献上: https://github.com/lytsing/MyPhoneNumber

If you enjoyed this post, make sure you subscribe to my RSS feed!

20 replies on “Android设置显示本机号码”

Hi!
HTC Desire A8181 running 2.2 (specifically 2.29.405.5, which is for unbranded phone) failed to install MyPhoneNumber via market.
Any ideas?

Hi, I have Android 2.2 on a Nexus One and I cant install this app (“Unknown Installation error -8”).

Any ideas?

Could you email me the .apk or source?

Thanks, Mike

hi all, because the signature is different, I use the android test -key. I am very sorry I can’t fix the bug on the device which has the private signature.

我喜欢Android手机。他们有更好的功能,给用户带来很多好处。不通告太多,仍然可以达到它的客户,受众和目标部门。

Leave a Reply to Hades Cancel reply

Your email address will not be published. Required fields are marked *