[TinyTut] - Replacing the DIAL-Action

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

[TinyTut] - Replacing the DIAL-Action

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

[TinyTut] - Replacing the DIAL-Action


What you learn: You will learn how to catch/replace the DIAL-Action that is broadcasted, when one starts typing numbers on the emulator-'desktop'.

Difficulty: 1 of 5 :)

:idea: Questions/Problems: Simply post below...

Description:
  1. Register the Activity you want your app to listen to it in the AndroidManifest.xml in the following way:
    Syntax: [ Download ] [ Hide ]
    Using xml Syntax Highlighting
    1.         ...
    2.         <activity class=".MyDIALHandlerApplication" android:label="@string/app_name">
    3.             <intent-filter>
    4.                 <action android:value="android.intent.action.DIAL" />
    5.                 <category android:value="android.intent.category.DEFAULT" />
    6.             </intent-filter>
    7.         </activity>
    8.         ...
    Parsed in 0.001 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

Top

Postby tabrej.khan » Sat Dec 06, 2008 1:32 pm

In SDK 1.0 use following:
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />

adroid:value gives error.

When I ran the application it didn't started any thing. But when I was having a call I pressed 5 key on the screen and it showed me the two option.
User avatar
tabrej.khan
Freshman
Freshman
 
Posts: 8
Joined: Wed Jul 16, 2008 6:16 am
Location: Bangalore, Karnataka

Not working for me

Postby bparker » Fri Dec 12, 2008 7:03 am

When I try this tutorial (replacing value with name as tabrej.khan stated), nothing happens.
"4. The system will ask you which one" ... but it doesn't :(

Any ideas?

Edit: I replaced "DIAL" with "CALL_BUTTON" and I do see the popup menu when pressing the call button... so I wonder why it won't work for dialing? Permissions perhaps?
bparker
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Dec 12, 2008 6:59 am

Re: Not working for me

Postby powerdeng » Sun Feb 22, 2009 5:50 pm

bparker wrote:When I try this tutorial (replacing value with name as tabrej.khan stated), nothing happens.
"4. The system will ask you which one" ... but it doesn't :(

Any ideas?

Edit: I replaced "DIAL" with "CALL_BUTTON" and I do see the popup menu when pressing the call button... so I wonder why it won't work for dialing? Permissions perhaps?



i've met same problem.
but after i checked the dialer mainfest file in the latest cupcake,the following code may work fine

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <intent-filter>
  2.                 <action android:name="android.intent.action.VIEW" />
  3.                 <action android:name="android.intent.action.DIAL" />
  4.                 <category android:name="android.intent.category.DEFAULT" />
  5.                 <category android:name="android.intent.category.BROWSABLE" />
  6.                 <data android:scheme="tel" />
  7.             </intent-filter>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
powerdeng
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 16, 2009 10:20 am
Location: Chengdu,China

Re: Not working for me

Postby DeveloperAmit » Tue Mar 10, 2009 7:00 am

hi guys...

I am trying out something similar...
i want to start my application when someone clicks a link say myapp://mydata
in a email or some other place ......
I tried using this code but when i open the browser & insert the link nothing happens....the browser instead searches the web!!
.
.
.
<data android:host="mydata" android:scheme="myapp"></data>

CAn anyone help me out on this ???
DeveloperAmit
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Mar 04, 2009 1:26 pm

Re: Not working for me

Postby powerdeng » Tue Mar 10, 2009 6:58 pm

DeveloperAmit wrote:hi guys...

I am trying out something similar...
i want to start my application when someone clicks a link say myapp://mydata
in a email or some other place ......
I tried using this code but when i open the browser & insert the link nothing happens....the browser instead searches the web!!
.
.
.
<data android:host="mydata" android:scheme="myapp"></data>

CAn anyone help me out on this ???


maybe this could help you
http://android-developers.blogspot.com/ ... -text.html

and i don't think you can type something in the brower and launch something else.

you can do this with Linkify. :)
powerdeng
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 16, 2009 10:20 am
Location: Chengdu,China

Top

problems....

Postby PI9 » Mon Apr 06, 2009 8:55 am

Hello,
I'm trying to start an HelloWorld application written with Eclipse when I start typing numbers on the emulator-'desktop' but it doesn't work.

What I implemented in AndroidManifest is the following:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  <activity android:name="Helloworldex" >
  2.  
  3.            <intent-filter>
  4.  
  5.                 <action android:name="android.intent.action.VIEW" />
  6.  
  7.                 <action android:name="android.intent.action.DIAL" />
  8.  
  9.                 <category android:name="android.intent.category.DEFAULT" />
  10.  
  11.                 <category android:name="android.intent.category.BROWSABLE" />
  12.  
  13.                 <data android:scheme="tel" />
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


HelloWorldex is a simple HelloWorld. I put the file Helloworldex.java in the file src of my current program, Helloincomingcall. I didn't put anything between the accolades as you can see below in my main file: Helloincomingcall.java:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class Helloincomingcall extends Activity {
  2.  
  3.     /** Called when the activity is first created. */
  4.  
  5.  
  6.  
  7. }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Could you please tell me if it's possible (or if it can only start applications that aren't on Eclipse) and, in the case when it's possible, what could be my problem ?
Thanks
an Android beginner...
PI9
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Apr 06, 2009 8:40 am

Re: problems....

Postby powerdeng » Mon Apr 06, 2009 12:32 pm

PI9 wrote:Hello,
I'm trying to start an HelloWorld application written with Eclipse when I start typing numbers on the emulator-'desktop' but it doesn't work.

What I implemented in AndroidManifest is the following:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  <activity android:name="Helloworldex" >
  2.            <intent-filter>
  3.                 <action android:name="android.intent.action.VIEW" />
  4.                 <action android:name="android.intent.action.DIAL" />
  5.                 <category android:name="android.intent.category.DEFAULT" />
  6.                 <category android:name="android.intent.category.BROWSABLE" />
  7.                 <data android:scheme="tel" />
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


HelloWorldex is a simple HelloWorld. I put the file Helloworldex.java in the file src of my current program, Helloincomingcall. I didn't put anything between the accolades as you can see below in my main file: Helloincomingcall.java:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class Helloincomingcall extends Activity {
  2.     /** Called when the activity is first created. */
  3.  
  4. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Could you please tell me if it's possible (or if it can only start applications that aren't on Eclipse) and, in the case when it's possible, what could be my problem ?
Thanks
an Android beginner...


Are you sure you ain't missing something ?

Here is the whole AnotherHelloWorld 's manifest that you can type a number to launch it.
sdk 1.1,right?


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3.      package="com.test.helloworld"
  4.      android:versionCode="1"
  5.      android:versionName="1.0.0">
  6.     <application android:icon="@drawable/icon" android:label="@string/app_name">
  7.         <activity android:name=".AnotherHelloWorld"
  8.                  android:label="@string/app_name">
  9.             <intent-filter>
  10.                 <action android:name="android.intent.action.MAIN" />
  11.                 <category android:name="android.intent.category.LAUNCHER" />
  12.             </intent-filter>
  13.             <intent-filter>
  14.                          <action android:name="android.intent.action.VIEW" />
  15.                          <action android:name="android.intent.action.DIAL" />
  16.                              <category android:name="android.intent.category.DEFAULT" />
  17.                          <category android:name="android.intent.category.BROWSABLE" />
  18.                          <data android:scheme="tel" />
  19.             </intent-filter>
  20.         </activity>
  21.     </application>
  22. </manifest>
Parsed in 0.004 seconds, using GeSHi 1.0.8.4
:) e2ecloud.com
powerdeng
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 16, 2009 10:20 am
Location: Chengdu,China

Postby PI9 » Tue Apr 07, 2009 9:17 am

Firstly, Thanks for your quick answer.
Nothing's missing it's just that i've pasted only the interesting part in the manifest file. My file was the same as yours.
My problem is that the phone doesn't ask me to choose between two applications when i start dialing... which is the purpose of the program as I understood it.
As I said previously, I haven't written anything in the body of the HelloIncomingCall class. Is it sufficient to just write in the manifest file that I want to start HelloWorldex

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. <activity
  2.  
  3.         android:name=".Helloworldex"
  4.  
  5.         android:label="@string/app_name">
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


or do I have to write it in another file ?

I hope you won't get lost yourself in my explanations and you'll be able to help me ...
Thanks in advance
PI9
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Apr 06, 2009 8:40 am

Postby powerdeng » Tue Apr 07, 2009 1:49 pm

well ~
maybe you have already set a default app for that action.
try to clear defaults in your application manager~

Settings->Applications->Manage applications->Dialer(or some other app that you launch now when typing numbers ) -> clear defaults.

or anything else is wrong...

so i attach the whole project~it works fine both on my emulator and G1.
Attachments
AnotherHelloWorld.zip
Nothing really...
(23.75 KiB) Downloaded 381 times
:) e2ecloud.com
powerdeng
Freshman
Freshman
 
Posts: 9
Joined: Mon Feb 16, 2009 10:20 am
Location: Chengdu,China

Re: [TinyTut] - Replacing the DIAL-Action

Postby iqueen » Thu Jul 29, 2010 9:44 am

<receiver android:name=".PhoneStateIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
iqueen
Freshman
Freshman
 
Posts: 3
Joined: Tue Dec 09, 2008 6:33 am

Re: [TinyTut] - Replacing the DIAL-Action

Postby Draffodx » Mon Nov 01, 2010 3:39 pm

Does this still work in 1.6+? Not working for me currently
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests