Replace Dialer

Put your problem here if it does not fit any of the other categories.

Replace Dialer

Postby willievu » Sun Dec 09, 2007 5:09 am

Is it possible to handle the android.intent.action.DIAL intent in place of the default Dialer?
willievu
Freshman
Freshman
 
Posts: 6
Joined: Tue Dec 04, 2007 9:16 am

Top

Postby plusminus » Sun Dec 09, 2007 5:27 pm

Hello willievu,

Yes, it is :!:

I'll transform this into a tutorial right now:

  1. Register it in the AndroidManifest.xml in the following way:
    Syntax: [ Download ] [ Hide ]
    Using xml Syntax Highlighting
    1.         <activity class=".ShortcutActivity" android:label="shortcut activity">
    2.             <intent-filter>
    3.                 <action android:value="android.intent.action.DIAL" />
    4.                 <category android:value="android.intent.category.DEFAULT" />
    5.             </intent-filter>
    6.         </activity>
    Parsed in 0.002 seconds, using GeSHi 1.0.8.4
  2. Run the app once and close it (just that it gets installed on the emulator)
  3. On the emulator-"desktop" start typing some numbers
  4. The system will ask you which one of two available activities you want to use to handle the DIAL action
    - the 1st one is the "Contacts" standard system activity
    - the 2nd one should be yours

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby willievu » Sat Dec 15, 2007 4:51 am

Thanks plusminus,

That works. I have a couple more questions.

1) How can I preload an app so that I don't need to run and close my app in order to make Android know my app wants to handle the DIAL intent?
2) When calling from the Contact app, it doesn't use the DIAL intent. In that case, is it possible to modify the contact phone number before making the call?
willievu
Freshman
Freshman
 
Posts: 6
Joined: Tue Dec 04, 2007 9:16 am

Postby plusminus » Sat Dec 15, 2007 2:58 pm

Hello willievu,

willievu wrote:1) How can I preload an app so that I don't need to run and close my app in order to make Android know my app wants to handle the DIAL intent?


You just needed to "run" it once, that it gets transfered to the emulator. You could also have done that manually.

willievu wrote:2) When calling from the Contact app, it doesn't use the DIAL intent. In that case, is it possible to modify the contact phone number before making the call?


Hm, did really get what you mean... :?:
Do you mean, that when some numbers were DIALed and when the Green Call Button was hit you want to modify the number :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby willievu » Sat Dec 15, 2007 6:45 pm

plusminus wrote:Hm, did really get what you mean... :?:
Do you mean, that when some numbers were DIALed and when the Green Call Button was hit you want to modify the number :?:


I mean I go into Contacts app, select a mobile phone and then click the Green Call Button. Before the call is made, I want to change the number being called.
willievu
Freshman
Freshman
 
Posts: 6
Joined: Tue Dec 04, 2007 9:16 am

Postby plusminus » Mon Dec 17, 2007 3:51 pm

Hello willievu,

haven't seen that before.
Not sure, if such a thing is available, as it would be the perfect point for ripping ones money by calling high-cost number without the user being aware of.

But I assume you want to do the other way around, like adding a "cheap"-number-prefix :)
On your own DIALing app this would be possible.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Postby cre813 » Fri Dec 28, 2007 7:03 am

plusminus wrote:The system will ask you which one of two available activities you want to use to handle the DIAL action
- the 1st one is the "Contacts" standard system activity
- the 2nd one should be yours


Hello,

The activity selection process occurs every time. Is there a way to allow the user to make the choice once and be done with it?

Thanks
cre813
Freshman
Freshman
 
Posts: 8
Joined: Fri Dec 28, 2007 6:57 am

Postby plusminus » Fri Dec 28, 2007 6:03 pm

Hello cre813,

up to now there unfortunately is no "always run with"-checkbox, but it would be a logical step for usability, because being asked would definitely tick everyone off :!:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby cre813 » Fri Dec 28, 2007 6:27 pm

plusminus wrote:Hello cre813,

up to now there unfortunately is no "always run with"-checkbox, but it would be a logical step for usability, because being asked would definitely tick everyone off :!:

Regards,
plusminus


Okay - I just wanted to make sure I wasn't missing something.

While one of the interesting features with Android is the ability to replace the base applications with custom ones, having to *always* select which one to run is basically a deal killer.

Thanks for your reponse.
cre813
Freshman
Freshman
 
Posts: 8
Joined: Fri Dec 28, 2007 6:57 am

can't get this to work on m5 SDK

Postby jackck » Sun Feb 24, 2008 8:44 pm

Hi Android community,

Please help. My intent receiver is not being called when I strike number keys on emulator. Contacts app always launches. I am using m5 SDK so might be the reason. My code is:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class DialIntentReceiver extends IntentReceiver {
  2.  
  3.  
  4.  
  5.                 @Override
  6.  
  7.                 public void onReceiveIntent(Context context, Intent intent) {
  8.  
  9.                         Log.i("DialIntentReceiver", "received intent");
  10.  
  11.                        
  12.  
  13.                 }
  14.  
  15. }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class ReplacementDialerActivity extends Activity {
  2.  
  3.     /** Called when the activity is first created. */
  4.  
  5.     @Override
  6.  
  7.     public void onCreate(Bundle icicle) {
  8.  
  9.         super.onCreate(icicle);
  10.  
  11.         setContentView(R.layout.main);
  12.  
  13.     }
  14.  
  15. }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.    package="com.jackck">
  6.  
  7.     <uses-permission android:name="android.permission.CALL_PHONE" />
  8.  
  9.  
  10.  
  11.     <application android:icon="@drawable/icon">
  12.  
  13.         <activity android:name=".ReplacementDialerActivity" android:label="@string/app_name">
  14.  
  15.             <intent-filter>
  16.  
  17.                 <action android:name="android.intent.action.MAIN" />
  18.  
  19.                 <category android:name="android.intent.category.LAUNCHER" />
  20.  
  21.             </intent-filter>
  22.  
  23.         </activity>
  24.  
  25.     </application>
  26.  
  27.    
  28.  
  29.         <receiver android:name=".DialIntentReceiver">
  30.  
  31.             <intent-filter>
  32.  
  33.                 <action android:name="android.intent.action.DIAL" />
  34.  
  35.                 <category android:name="android.intent.category.DEFAULT" />
  36.  
  37.             </intent-filter>
  38.  
  39.         </receiver>
  40.  
  41. </manifest>
Parsed in 0.004 seconds, using GeSHi 1.0.8.4
User avatar
jackck
Freshman
Freshman
 
Posts: 4
Joined: Thu Feb 21, 2008 5:26 am

Postby plusminus » Sun Feb 24, 2008 9:20 pm

Hello jackck,

in the AndroidManifets.xml you need to place the <receiver>-tag inside of the <application>-tag.
It should work then.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby jackck » Tue Feb 26, 2008 8:35 pm

For some reason it still doesn't work after putting the intent reciever tag inside application tag:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.    package="com.jackkwok">
  6.  
  7.     <uses-permission android:name="android.permission.READ_CONTACTS" />
  8.  
  9.     <uses-permission android:name="android.permission.CALL_PHONE" />
  10.  
  11.     <uses-permission android:name="android.permission.RECEIVE_SMS" />
  12.  
  13.     <uses-permission android:name="android.permission.ACCESS_GPS" />
  14.  
  15.     <uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
  16.  
  17.     <uses-permission android:name="android.permission.ACCESS_LOCATION" />
  18.  
  19.     <uses-permission android:name="android.permission.ACCESS_CELL_ID" />
  20.  
  21.     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  22.  
  23.     <application android:icon="@drawable/icon">
  24.  
  25.         <activity android:name=".ReplacementDialerActivity" android:label="@string/app_name">
  26.  
  27.             <intent-filter>
  28.  
  29.                 <action android:name="android.intent.action.MAIN" />
  30.  
  31.                 <category android:name="android.intent.category.LAUNCHER" />
  32.  
  33.             </intent-filter>
  34.  
  35.         </activity>
  36.  
  37.  
  38.  
  39.         <receiver android:name=".DialIntentReceiver">
  40.  
  41.             <intent-filter>
  42.  
  43.                 <action android:name="android.intent.action.DIAL" />
  44.  
  45.                 <category android:name="android.intent.category.DEFAULT" />
  46.  
  47.             </intent-filter>
  48.  
  49.             <intent-filter>
  50.  
  51.                 <action android:name="android.intent.action.ANSWER_ACTION" />
  52.  
  53.                 <category android:name="android.intent.category.DEFAULT" />
  54.  
  55.             </intent-filter>
  56.  
  57.         </receiver>
  58.  
  59.      </application>
  60.  
  61. </manifest>
Parsed in 0.006 seconds, using GeSHi 1.0.8.4
User avatar
jackck
Freshman
Freshman
 
Posts: 4
Joined: Thu Feb 21, 2008 5:26 am

Postby Steph » Mon Oct 27, 2008 2:51 pm

I think it doesn't work with the new SDK, SDK 1.

I'm right?
Steph
Experienced Developer
Experienced Developer
 
Posts: 90
Joined: Mon Oct 20, 2008 1:48 pm
Location: France

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 11 guests