开发者

In android how to get phone number of caller (i mean our own phone no)? [closed]

开发者 https://www.devze.com 2023-02-26 05:22 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

**

how to get phone no of caller (i mean our own phone no)?

**I got the reciever phone number but not getting caller phone no开发者_如何学Go.If any idea please tell me?


Take a look at

How to get the phone number of the phone in android code?

and

How to get phone number of an android CDMA phone?


to get ur phone no following code is used

         final Context context = getApplicationContext();
        TelephonyManager tMgr = (TelephonyManager) context
    .getSystemService(Context.TELEPHONY_SERVICE);
           String mPhoneNumber = tMgr.getLine1Number();

and add uses-permission for

 android.permission.READ_PHONE_STATE

in androidmanifest.xml

0

精彩评论

暂无评论...
验证码 换一张
取 消