locked
How to get sim number from dual sim phone android. RRS feed

  • Question

  • User225840 posted

    Im always getting an error of Java.Lang.SecurityException: getLine1NumberForDisplay: Neither user 10710 nor current process has android.permission.READSMS. Even if I already Added the READSMS in AndroidManifest.xml

        public string GetNumber()
         {
                TelephonyManager telephonyManager = (TelephonyManager)GetSystemService(TelephonyService);
                return telephonyManager.Line1Number;
         }
    
    Wednesday, July 13, 2016 5:04 AM

All replies

  • User182106 posted

    Namespace: Android.Telephony Requires Permission: Permission.ReadPhoneState

    var tm = (TelephonyManager)GetSystemService(TelephonyService); String phonenumberstring = null; phonenumberstring = tm.Line1Number; var lineView = (TextView)FindViewById(Resource.Id.linenumbertxt); lineView.Append( " Phone Number: " + phonenumberstring );

    Wednesday, May 3, 2017 1:50 PM