I got this example working in processing just now, i got it running in the emulator but I had to export as an android project and run in eclipse on my phone to be sure it worked but i WAS able to call my voicemail successfully, so i can only assume it will work for other numbers.
here is the code i used, i pulled it from the 1st tutorial posted and cleaned it up a bit and made it processing compliant (which just means I changed the Log.e statement to a println and changed the structure a little bit, not much was done to get it working)
CODE:
- void setup(){
- try{
- PhoneCall dialer = new PhoneCall();
- }
- catch(Exception e){
- e.printStackTrace();
- }
- }
- void draw(){
-
- }
Next create a new tab, call it PhoneCall, and put this code in it
CODE:
- import android.content.Intent;
- import android.net.Uri;
- import android.os.Bundle;
- public class PhoneCall{
- public PhoneCall() {
- try {
- Intent callIntent = new Intent(Intent.ACTION_CALL);
- callIntent.setData(Uri.parse("tel:INSERT-PHONE-NUMBER-HERE"));
- startActivity(callIntent);
- }
- catch (Exception e) {
- println("Call failed: ");
- e.printStackTrace();
- }
- }
- }
And be sure to change where it says
INSERT-PHONE-NUMBER-HERE
on line 10 above to the number you want to call, being sure to leave the rest alone.
And that's it, simple as that.
The wonderful thing about Processing is that it is all based on Java, meaning you can run any Java code natively in Processing with as little as an import statement or two, if they are needed at all. Which also means that in Android mode in Processing we can run *just about* any code (the gui objects in Android don't play well with Processing, just like Java Swing components don't play well with the desktop version). For more info on Processing for Android see here:
Processing for Android Wiki.
Good luck!