다음 소스는 TelephonyManager를 통한 핸드폰 번호 가져오기
@Override
public String getPhoneNumber() {
TelephonyManager telephony = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String phoneNumber ="";
try {
if (telephony.getLine1Number() != null) {
phoneNumber = telephony.getLine1Number();
}
else {
if (telephony.getSimSerialNumber() != null) {
phoneNumber = telephony.getSimSerialNumber();
}
}
}
catch(Exception e) {
e.printStackTrace();
}
return phoneNumber;
}