-1

I'm developing an app which requires that the user needs to be inaccessible to options when a call is automatically made... (for safety reasons)

So basically I want to erase (or disable) some of the options bellow:

enter image description here

Is there a way to accomplish this?

slyzer
  • 215
  • 1
  • 19

1 Answers1

0

You can't just remove existing layout from an existing app or run calling in background (like hiding from the user). However, you can create a new dialer app and NOT OPEN THE DIALER SCREEN. Instead, you can open a new activity.

First of all, include this permission in your AndroidManifest.xml

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

Then, add this function and use it when you want to.

/**
 * Opens a new ACTION_CALL Intent instead of ACTION_DIAL.
 * @param num String representation of the number you are calling
 */
private void call(String num) {
    try {
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse("tel:" + num));
        startActivity(callIntent);
    } catch (ActivityNotFoundException e) {
        Log.e("sample call in android", "Call failed", e);
    }
}

Note that it's not calling startService(callIntent). It is starting a new Activity instead.

Hope this helps.

Saehun Sean Oh
  • 2,103
  • 1
  • 21
  • 41
  • Hi, thanks for your answer... I already did that... maybe I wasn't clear... I made the call through the app... but even if I made a custom UI to the caller, your code doesn't apply... do you know how can I make this? – slyzer Sep 25 '15 at 18:42
  • Oh okay. In that case, you might want to look at [here](http://stackoverflow.com/questions/5029183/android-dialer-application). But then I don't know how getting rid of the options could improve safety. – Saehun Sean Oh Sep 25 '15 at 18:46
  • thanks again for your answer, I will take a look... it could when the calling is used for emergency purposes... give the user the ability to turn off or put on hold the call is a safety problem... – slyzer Sep 28 '15 at 10:08