Want to de-bounce andriod "phone dial" target

Christopher Schene
Christopher Schene used Ask the Experts™
on
I would like to write an Android application intercept a click on the green phone icon on the "recent calls" screen. I keep on touching this target accidentally and end up "butt dialing" folks.  It is very embarrassing to butt dial my manager at 1am on a weekend.

If I had my choice what I would like to do is optionally "beep" or make some sound so that I know I hit the target to dial someone the droid would ask me to confirm.

I think i can get started if I know:

1) How to intercept a touch on the green telephone icon to prevent it from dialing
2) How to popup a messages asking me to confirm or optionally timeout and default to either "dial" or "don't dial" (this should be configurable)
3) How to Dial the number after optional confirm
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
The way to intercept the green phone icon is to create an app which is a dialer and set it as your default dialler. Your app can then call the system dialler after popping up messages or timing out. Note that your dialler app will take over all call functions if it is set as the default intent for making a call, not just in the "recent calls" screen.

Have a look at this ....
http://stackoverflow.com/questions/5029183/android-dialer-application


Note that some models of phone will ignore the system default dialler setting and just use their own custom dialler no matter what you do (HTC springs to mind).

Cheers,
   Chris
Christopher ScheneSystem Engineer/Software Engineer

Author

Commented:
Hi,

I need to set up a project and it  may take me a few days.

How can I tell if my phone will ignore the "default" dialer?

Can you point me to a starter project? Should I be using Eclipse?

Chris
Eclipse is the usual medium for creating an Android project as the SDK integrates into it well.

http://stackoverflow.com/questions/6665594/call-dialer-issue-in-android gives some information on the intent filters your application will require.

First thing I would do is set up an empty project, add the intent filters to the manifest, then install it onto the phone. Try to make a call - if you are asked which dialler to use then your phone will recognise a custom dialler.

I had a quick Google and couldn't find any example projects to help you out unfortunately.

Cheers,
   Chris
How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

SanthanaTechnical Lead
Commented:
Hi cschene,

I have written small app to intercept the outgoing call...

Execute this app....While calling to any number it will lauch the CallIntercepter
activity...From here if you press the call button it will call the appropriate number other wise it will stay in the same activity......
CallIntercepter.java
SanthanaTechnical Lead

Commented:
Hi cschene,

Change Your manifest file some thing like this
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PRIVILEGED" />

<application  android:icon="@drawable/ic_launcher" android:label="@string/app_name">
               <activity  android:name=".CallIntercepter " android:label="@string/app_name">
                         <intent-filter>            
                              <action android:name="android.intent.action.CALL_PRIVILEGED" />
                              <category android:name="android.intent.category.DEFAULT" />
                               <data android:scheme="tel" />
                         </intent-filter>    
                 </activity>
</application>
@santhanasamy

Your CallIntercepter.java is uploaded in rich text format, you might want to upload it in plain text instead.

Cheers,
   Chris
SanthanaTechnical Lead

Commented:
Hi cschene,

Now check...it...
CallIntercepter.java
Christopher ScheneSystem Engineer/Software Engineer

Author

Commented:
Hi,

I am in the process of building a java package with Eclipse.....I should have this tested in two days. I have only created one other Android app----so I a bit slow.
Christopher ScheneSystem Engineer/Software Engineer

Author

Commented:
Experts,

I am working on the application: I have created a project....but I am getting compile errors.

So, I made a new project as shown below....this does load and run on the Driod. So, the next step would be to add another package to the project with the name "Callinterceptor"

package chris.schene.custom_dialer;

import android.app.Activity;
import android.os.Bundle;

public class Custom_dialerActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
SanthanaTechnical Lead

Commented:
Hi cschene,

I guess no need to create a different activity ... Just use the  attached java file CallIntercepter as the Your applications launcher activity.......And change the Androidmanifest.xml accordingly...
Hope this works out - if the recent calls list is part of the Contacts activity (I don't know) you might not be able to intercept the dialer this way as the Contacts activity uses its built-in dialer regardless

An alternative would be to declare your app as a BroadcastReceiver for the NEW_OUTGOING_CALL intent i.e.

<intent-filter android:priority="1"> 
  <action android:name="android.intent.action.NEW_OUTGOING_CALL" /> 
   <category android:name="android.intent.category.DEFAULT" /> 
 </intent-filter> 

Open in new window

That would intercept an outgoing call after it's dialed.

see http://developer.android.com/reference/android/content/Intent.html#ACTION_NEW_OUTGOING_CALL for more info if it turns out you need this.

Cheers,
   Chris
Christopher ScheneSystem Engineer/Software Engineer

Author

Commented:
I was helped by all of your comments so I split points....Not quite working yet, but I am on the right track...I'll post more questions if I get stuck again.<br /><br />Thanks experts!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial