How to get incoming call's network(carrier) details in android

Jai

I want get incoming call details in android phone for an example when some one calling my android phone to get details of his number's network(carrier) like that for Airtel Vodefone and docomo etc, Using this method I am getting all details but not carrier details

public String[] callduration(){

    String callername="",type="";
    Cursor managedCursor = null;
    int number = 0,name,duration = 0,calltype = 0,date = 0;
    Uri contacts;

    try {

        contacts = CallLog.Calls.CONTENT_URI;

        managedCursor = mContext.getContentResolver().query(contacts, null, null, null, null);
        number = managedCursor.getColumnIndex( CallLog.Calls.NUMBER); 
        name= managedCursor.getColumnIndex(CallLog.Calls.CACHED_NAME);
        duration = managedCursor.getColumnIndex( CallLog.Calls.DURATION);
        calltype = managedCursor.getColumnIndex( CallLog.Calls.TYPE);
        date = managedCursor.getColumnIndex(CallLog.Calls.DATE);
        managedCursor.moveToLast();

        callername = managedCursor.getString(name);
        if(callername == null){
             callername = managedCursor.getString(number);
        }

        if (managedCursor.getString(calltype).equalsIgnoreCase("1")) {

            type = "Incoming";

        }else if (managedCursor.getString(calltype).equalsIgnoreCase("2")){

            type = "Outgoing";

        }

    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();

    }

    return new String[]{callername,managedCursor.getString(number),managedCursor.getString(duration),
                        managedCursor.getString(date),type};
 }
stacktry

Official tutorial,

https://developer.android.com/reference/android/telephony/TelephonyManager.html

also refer this, How to detect incoming calls, in an Android device?


getSimOperator() -Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM.


In manifest file,

give below permission,

< uses-permission android:name="android.permission.READ_PHONE_STATE" />

< uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Get incoming call number programmatically on android 10

分類Dev

How to answer automatically and programatically an incoming call on android

分類Dev

How to read the number of incoming call on Android Device

分類Dev

How to Intercept incoming call in Mule

分類Dev

Get event for incoming call when application in background

分類Dev

Intercept incoming call in a rooted Android (Jelly Bean)

分類Dev

How can I get the caller from an incoming phone call webhook request?

分類Dev

How to achieve a "contact" button on incoming call screen

分類Dev

How can I get Record's details using Rtti?

分類Dev

How to redirect already answered incoming call using pjsip?

分類Dev

Verifying login details via http get : Android

分類Dev

Unable to upload a file in Android and there's no details of an error

分類Dev

PJSUA2 Java - How to get ongoing Call's AudioMedia

分類Dev

PopUp while receiving Incoming Call

分類Dev

Twilio add incoming call to queue and call to the agent

分類Dev

How to reject or accept an incoming call to my GSM modem using AT commands in Python?

分類Dev

How can I call another android application in my android application's user interface?

分類Dev

Android – Listen For Incoming SMS Messages

分類Dev

Windows 8.1 detect incoming phone call

分類Dev

How to get the Android device's primary e-mail address

分類Dev

How to get Android's gateway/router IP through Shell?

分類Dev

Linq How to get the master record and a specific field of inner details record

分類Dev

How get a course section details in Canvas LTI 2.0

分類Dev

How to get users with specific roles with their profile details in laravel

分類Dev

How to get the IP address of an incoming data packet on a DGRAM socket in WinSock2?

分類Dev

How to detect a call Drop in android

分類Dev

Get FB likers details

分類Dev

Audio not working when incoming call is answered during screen is locked - swift

分類Dev

How to implictly call parent class's constructor

Related 関連記事

  1. 1

    Get incoming call number programmatically on android 10

  2. 2

    How to answer automatically and programatically an incoming call on android

  3. 3

    How to read the number of incoming call on Android Device

  4. 4

    How to Intercept incoming call in Mule

  5. 5

    Get event for incoming call when application in background

  6. 6

    Intercept incoming call in a rooted Android (Jelly Bean)

  7. 7

    How can I get the caller from an incoming phone call webhook request?

  8. 8

    How to achieve a "contact" button on incoming call screen

  9. 9

    How can I get Record's details using Rtti?

  10. 10

    How to redirect already answered incoming call using pjsip?

  11. 11

    Verifying login details via http get : Android

  12. 12

    Unable to upload a file in Android and there's no details of an error

  13. 13

    PJSUA2 Java - How to get ongoing Call's AudioMedia

  14. 14

    PopUp while receiving Incoming Call

  15. 15

    Twilio add incoming call to queue and call to the agent

  16. 16

    How to reject or accept an incoming call to my GSM modem using AT commands in Python?

  17. 17

    How can I call another android application in my android application's user interface?

  18. 18

    Android – Listen For Incoming SMS Messages

  19. 19

    Windows 8.1 detect incoming phone call

  20. 20

    How to get the Android device's primary e-mail address

  21. 21

    How to get Android's gateway/router IP through Shell?

  22. 22

    Linq How to get the master record and a specific field of inner details record

  23. 23

    How get a course section details in Canvas LTI 2.0

  24. 24

    How to get users with specific roles with their profile details in laravel

  25. 25

    How to get the IP address of an incoming data packet on a DGRAM socket in WinSock2?

  26. 26

    How to detect a call Drop in android

  27. 27

    Get FB likers details

  28. 28

    Audio not working when incoming call is answered during screen is locked - swift

  29. 29

    How to implictly call parent class's constructor

ホットタグ

アーカイブ