Auto-Call

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

Auto-Call

Postby PI9 » Tue May 19, 2009 8:54 am

Hello,

I tried to add a function to a small app I did few times ago: dial and call a predefined phone number.

So here is the code I used:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3.  
  4. private Intent CallIntent,DialIntent;
  5.  
  6. private String num_op = "0561812124";
  7.  
  8.  
  9.  
  10. DialIntent = new Intent (Intent.ACTION_DIAL, Uri.parse("tel:"+ num_op));
  11.  
  12. DialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  13.  
  14. CallIntent = new Intent (Intent.ACTION_CALL, Uri.parse("tel:"+ num_op));
  15.  
  16. CallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  17.  
  18.  
  19.  
  20. startActivity(DialIntent);
  21.  
  22. startActivity(CallIntent);
  23.  
  24.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Of course, I used the right permission (CALL_PHONE) in my AndroidManifest..

Then, the app run on the emulator but it crashes when I try to make it run on the DevPhone.
Does anyone know why?
What is the problem with this code?

Thanks
PI9
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Apr 06, 2009 8:40 am

Top

Return to Other Coding-Problems

Who is online

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