I am developing an VoIP app.
My app registers to a SIP based back-end server using a User-ID and password.
Once the registration is successful, the user can make sip calls through this app.
If the user uses the native phone dialer to dial out a number, My app intercepts the call and places the call through SIP.
Once the call is intercepted, the native phone dialer goes to background and my app's 'call status' screen is displayed(my app comes to foreground).
My requirements are as follows:
Once the call is intercepted, instead of showing my app's UI, we need to display the native dialer(default phone dialer) 'call status' / 'call progress' screen(like Samsung's Touchwiz for Samsung phones, HTC Sense for HTC phones etc), but the call should go through my app(SIP). Our app should take control over all the functionality of the native dialer 'call status' screen.
Eg: If the user taps the 'Call End' button on the 'Call Status' screen of the native dialer, my app should end the call. Similarly all the controls on the 'Call Status' screen of the native dialer should handover control to my app to take the necessary action.
Please let me know if it is possible to accomplish this and how to implement.
*public void onReceive(final Context context, Intent intent) {
final String intentAction = intent.getAction();
if (intentAction.equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
SharedPreferences getPrefs = PreferenceManager
.getDefaultSharedPreferences(context);
boolean bool_CustomFlag = getPrefs.getBoolean(
"use_custom_dialer_preference", true);
if (bool_CustomFlag == true) {
setResultData(null);
final String strPhoneNum = intent*
.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
(new Thread() {
public void run() {
try {
Intent intent = new Intent(Intent.ACTION_CALL,Uri.fromParts("my_data_scheme",
Uri.decode(strPhoneNum),null));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
} }*
I have created my own data scheme for my outgoing call activity so that brodcastreciver can listen to Action_outgoing_call and launch the my outgoing call activity when call is made through native dialer.
*<activity
android:name=".OutgoingCallActivity"
android:screenOrientation="portrait">
<intent-filter >
<action android:name="android.intent.action.CALL" />
<category android:name= "android.intent.category.DEFAULT" />
<data android:scheme = "sip" />
<data android:scheme="my_data_scheme" />
</intent-filter>
</activity>*`