Gets the phone number the app is running on. It needs a permission so add the line uses-permission android:name="android.permission.READ_PHONE_STATE" to the manifest.xml
private String getMyPhoneNumber() { TelephonyManager mTelephonyMgr; mTelephonyMgr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); return mTelephonyMgr.getLine1Number(); } private String getMy10DigitPhoneNumber() { String s = getMyPhoneNumber(); return s.substring(2); } Note : Keep in mind that phone number may NOT be available, depending on the carrier. On Thu, Nov 3, 2011 at 5:03 PM, suresh <sureshmca.sv...@gmail.com> wrote: > hi Ratheesh can u tel me which settings i should give. > > On Nov 3, 4:23 pm, Ratheesh Valamchuzhy <android...@gmail.com> wrote: >> make sure you give all the settings > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en