• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Making aCall

Hi
I am new to Android App development, so excuse me if I make some mistakes!
I am trying to write an app that will make a phone call when you click a 'Connect' button. What I have done so far is working, however, when you click the Connect button, the Android phone app opens up on top of my app. My app is still there - you can switch back to it. I want my app to keep the focus - is it possible to suppress the android phone app from showing, or do I need to make a call a different way?
My code is shown below:
int checkPermission = ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CALL_PHONE);
if (checkPermission == PackageManager.PERMISSION_GRANTED) {
startActivity(new Intent(Intent.ACTION_CALL , Uri.parse("tel:07XXXXXXXXX")));
}
else{
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CALL_PHONE}, 1);
}

Hope I have made what I want to do clear! Thanks in advance for any advice!
Mike
 
Hi LV426
Thanks for your reply. I hadnt added your lines, but when I did, it made no difference. The intent-filter in my manifest now looks like this:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
but this still looks like it works in the same way. When my app makes the call, I get the attached screenshot come up. The call is made, and I can return to my app with the call live. What i would like to do is suppress this screen.
I have had a look through the link that you included, and I am a bit worried that in the article it says:
"You can replace only the Dialer that way. The actual calling thing (what you see during calls) can't be changed."
Does this mean the what I am seeing?
Thanks again for your your help
Mike
 

Attachments

  • Screenshot.png
    Screenshot.png
    807.8 KB · Views: 112
Back
Top Bottom