Example: Make a phone call

donv edited this page Aug 16, 2012 · 4 revisions

Example: Make a phone call

Our goal

Make a phone call.


This tutorial has been tested with the following setups

Platform JDK ant Ruby ruboto jruby-jars Device API level Tester
OS X 10.8.0 1.6.0_33 1.8.2 MRI 1.8.7 0.8.0 HTC Desire HD android-10 donv

Generate, install, and start your app

ruboto gen app --package org.ruboto.examples.ruboto_phone_home
cd ruboto_phone_home
rake install start

You should see an application called "Ruboto Phone Home" in your application list on the device. You should eventually get "What hath Matz wrought?" and a button. Clicking the button displays a short notification (toast) "Flipped a bit via butterfly".

A fresh app

Request phone call permission

Add the following permissions to AndroidManifest.xml just below the uses-sdk tag.

    <uses-permission android:name="android.permission.CALL_PHONE" />

Make the call

Edit the file src/ruboto_phone_home_activity.rb to this:

import "android.content.Intent"
import "android.net.Uri"

class RubotoPhoneHomeActivity
  def on_create(bundle)

  def on_resume
    intent = Intent.new(Intent::ACTION_CALL)

Update and start the app

rake install start

After the app has started, it should display the phone app and make a call to the given number. The call should abort after a couple of seconds if the given number is invalid.

Ruboto Home Page

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.