Native Android Actions

Appportunity

Build your own Android App Dev Empire

Get Instant Access

Native Android applications also use Intents to launch Activities and sub-Activities.

The following non-comprehensive list shows some of the native actions available as static string constants in the Intent class. When creating implicit Intents you can use these actions, called Activity Intents, to start Activities and sub-Activities within your own applications.

Later you will be introduced to Intent Filters and you'll learn how to register your own Activities as handlers for these actions.

> action_answer Opens an Activity that handles incoming calls. Currently this is handled by the native in-call screen.

> action_call Brings up a phone dialer and immediately initiates a call using the number supplied in the Intent URI. Generally it's considered better form to us&ction_dial if possible.

> action_delete Starts an Activity that lets you delete the data specified at the Intent's data URI.

> action_dial Brings up a dialer application with the number to dial pre-populated from the Intent URI. By default this is handled by the native Android phone dialer. The dialer can normalize most number schemas: for example, tel:555-1234 and tel:(212) 555 1212 are both valid numbers.

> action_edit Requests an Activity that can edit the data at the specified Intent URI.

> action_insert Opens an Activity capable of inserting new items into the Cursor specified in the Intent URI. When called as a sub-Activity it should return a URI to the newly inserted item.

> action_pick Launches a sub-Activity that lets you pick an item from the Content Provider specified by the Intent URI. When closed it should return a URI to the item that was picked. The Activity launched depends on the data being picked: for example, passing content://contacts/people will invoke the native contacts list.

> action_search Launches the Activity used for performing a search. Supply the search term as a string in the Intent's extras using thffiearchManager.QUERY key.

> action_sendto Launches an Activity to send a message to the contact specified by the Intent URI.

> action_send Launches an Activity that sends the data specified in the Intent. The recipient contact needs to be selected by the resolved Activity. Use setType to set the MIME type of the transmitted data.

The data itself should be stored as an extra by means of the key extra_text or extra_stream, depending on the type. In the case of e-mail, the native Android applications will also accept extras via the extra_email, extra_cc, extra_bcc, and extra_subject keys. Use the action_send action only to send data to a remote recipient (not another application on the device).

> action_view The most common generic action. View asks that the data supplied in the Intent's URI be viewed in the most reasonable manner. Different applications will handle view requests depending on the URI schema of the data supplied. Natively http: addresses will open in the browser, tel: addresses will open the dialer to call the number, geo: addresses will be displayed in the Google Maps application, and contact content will be displayed in the contact manager.

> action_web_search Opens an Activity that performs a web search based on the text supplied in the Intent URI (typically the browser).

As well as these Activity actions, Android includes a large number of broadcast actions used to create Intents that are broadcast to announce system events. These broadcast actions are described later in this chapter.

Was this article helpful?

0 0
Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Responses

  • Pervinca
    What is navie Android action in android?
    2 years ago
  • Santina
    How to call native application ACTION_WEB_SEARCH?
    2 years ago
  • carita
    What are native android actions?
    2 years ago
  • Yvonne
    What are naive android actions?
    1 year ago

Post a comment