如何在J2ME中获取电话号码? [英] How to get phone number in J2ME?

查看:105
本文介绍了如何在J2ME中获取电话号码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在J2ME应用程序中获取电话号码(而非联系电话等)?手机中属于SIM卡的电话号码.

解决方案

电话中属于SIM卡的电话号码...

以上假设是错误的.

SIM卡未存储您的电话号码

SIM卡仅存储与您的电话号码无关的唯一标识符.

移动与网络的交互方式如下:

- [phone] hello network, ID on my SIM is 12345
- [network] hello 12345, I recognized you as a sim card
            currently bound to phone number 987-654-321

如果您对详细信息感兴趣,上面的内容已很好地描述了 JSR 177 SATSA ,那么您需要了解 APDU 的工作原理.但这并不能帮助您获取电话号码.

但是...为什么呢?

您的意思是,为什么他们使用一些唯一的标识符而不是电话号码?这很容易.只要想一想当您松动或破坏SIM卡时会发生什么,或者当有人偷走SIM卡时会发生什么更好的事情.

您想要新的SIM卡,但是想要您以前的号码吗?很好-您去办公室,他们会给您新的SIM卡并将其绑定到您的旧号码.现在,它如何工作,

- [stolen phone] hello network, ID on my SIM is 12345
- [network] hello 12345, I recognized you as invalid sim card
            so I will ignore you
- [your new phone] hello network, ID on my SIM is 23456
- [network] hello 23456, I recognized you as a sim card
            currently bound to phone number 987-654-321

可以,但是为什么他们为什么不同时存储IMSI和电话号码呢?

因为那样便宜得多.请重新考虑丢失或损坏的SIM卡的情况.怎么了?您来办公室时,服务员给您提供了新的SIM卡,并在数据库中添加了一条记录,告知您SIM卡ID现在已绑定到您的旧电话号码.简单又便宜.

如果他们必须将您的电话号码存储在SIM卡上,则他们必须以某种方式将其记录在其中,并测试添加的记录是否按预期工作.那是额外的工作-他们将从中得到什么?没事.

但是...但是这似乎可以用iPhone做到吗?

并非如此:在iOS中以编程方式获取自己的电话号码

How to get the phone number (not contact numbers,etc) in J2ME application ? The phone number that belongs to sim card in the phone.

解决方案

phone number that belongs to sim card in the phone...

above assumption is wrong.

sim card does not store your phone number

SIM card stores only a unique identifier which has nothing to do with your phone number.

The way mobile interacts with network is about as follows:

- [phone] hello network, ID on my SIM is 12345
- [network] hello 12345, I recognized you as a sim card
            currently bound to phone number 987-654-321

If you're interested in details, above is nicely described in this article

If you want to learn more about this unique ID, search the web for term International Mobile Subscriber Identity (IMSI). If you want to access this data from Java ME, you most likely need phone supporting JSR 177 SATSA and you need to understand how APDU works. But that won't help you to get the phone number.

but... why is that?

You mean, why they use some unique identifier instead of phone number? That's easy. Just think of what happens when you loose or break your SIM card, or better yet when someone steals it.

You want new SIM card, but you want your prior number? Fine - you go to the office and they give you new SIM card and bind it to your old number. Now, how it works after that,

- [stolen phone] hello network, ID on my SIM is 12345
- [network] hello 12345, I recognized you as invalid sim card
            so I will ignore you
- [your new phone] hello network, ID on my SIM is 23456
- [network] hello 23456, I recognized you as a sim card
            currently bound to phone number 987-654-321

ok fine but why oh why don't they store both IMSI and phone number?

Because it's much cheaper that way. Think again on the case of lost/broken SIM. What happens? You come to the office, guy at the desk gives you new SIM card and adds a record in database telling that SIM id is now bound to your old phone number. That's simple and cheap.

If they had to store your phone number on SIM card, they would have to somehow record it there and to test if the added record works as expected. That's extra work - and, what would they gain from that? Nothing.

but... but this seems somehow doable with iPhone isn't it?

Not quite so: Programmatically get own phone number in iOS

这篇关于如何在J2ME中获取电话号码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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