Link to home
Start Free TrialLog in
Avatar of Christopher Schene
Christopher ScheneFlag for United States of America

asked on

Want to de-bounce andriod "phone dial" target

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
ASKER CERTIFIED SOLUTION
Avatar of tampnic
tampnic
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Christopher Schene

ASKER

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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Hi cschene,

Now check...it...
CallIntercepter.java
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.
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);
    }
}
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
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!