Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
929 views
in Technique[技术] by (71.8m points)

android - What does getLine1Number() return with dual SIM phones?

What does getLine1Number() method of TelephonyManager return with dual SIM phones like LG Optimus Net Dual?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You'll get back only one number ... maybe!

First, which number you get back is device dependent.

But equally importantly whether you will get a number at all, and whether this number will be the phone number, is completely unpredictable. This is SIM and operator dependent.

In one of my apps, I started off trying to use the phone number as a unique ID, since I could expect the user to recall this number easily. For most operators in Asia, Australia and some in Europe, the phone number (line1number()) is simply not stored on the SIM! With others, you may get a string of zeroes. Or a number formatted in a way that may make sense locally but could mess up your app's logic.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...