下面的代碼不給我設備的電話號碼,我怎樣才能獲得的電話號碼Android手機號碼
TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
String number = tm.getLine1Number();
Toast.makeText(getApplicationContext(),"Telephone number: "+ number,
Toast.LENGTH_SHORT).show();
我也有試過following..but數量利己顯示
Programmatically obtain the phone number of the Android phone
How to get the mobile number of current sim card in real device?
你插入了SIM卡嗎?它會返回什麼? – Reno
這個數字並不總是有效的。例如,一些預付卡沒有存儲在SIM卡中的號碼。 –
是的,我已經插入了SIM卡,並不是預付卡.. – Rajeev