0

I am working on an application in which I have to make call from my application using my PHP server.

I have a condition in which, whenever user presses the Green call button of Android Device and after dialing number, I have to give user an option to call from my App or normal SIM. I have done that too. Now I want to get the number which I have dialed on the dialer before switching to the application.

Means if User selects my application to call then I must have number dialed on the phone Dial.

I am using the below code to generate the pop up to use my application for calling. The code is written as Intent filter in my manifest inside the specific activity.

<activity
            android:name="com.tv.longdistcall.PlaceLongDistCall"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="android.intent.action.CALL_BUTTON" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.CALL_PRIVILEGED" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:scheme="tel" />
            </intent-filter>
        </activity>

Please suggest me, how to get the number dialed on the dialer before switching to the activity.

Kara
  • 6,115
  • 16
  • 50
  • 57
Sam-In-TechValens
  • 2,501
  • 4
  • 34
  • 67
  • can see this http://stackoverflow.com/questions/9909153/how-to-get-dialed-mobile-number-in-my-application – user1969053 Feb 12 '13 at 09:27
  • @njzk2 : As i wrote above, I am working with that code which is giving me an option to select app or phone to call. the problem that approch is, I am not getting the dialed number in my application. please let me know, if you can help now. Also I am trying with the BroadcastReceiver, but it will not give me an option to select for user. – Sam-In-TechValens Feb 12 '13 at 09:59

1 Answers1

0

You need to create a new BroadcastReceiver with NEW_OUTGOING_CALL intent filter. This receiver intercepts every call to CALL_PRIVILEGED or CALL actions on the device regardless of what app is the one targeted.

The destination number can be found on the receiver's intent extras in Intent.EXTRA_PHONE_NUMBER.

AsafK
  • 2,425
  • 3
  • 32
  • 38