Android Intent Filters

0 Flares 0 Flares ×
Editor’s note: This blog post is a basic tutorial. The most up-to-date version is available in the wiki.

Android Intent Filters give Appcelerator apps the ability to receive Intents from other Android applications. If you are an Android device user, you’re probably familiar with the SEND Intent. It’s the one that pops up a “Share via” list of apps when you attempt to share links, pictures, videos, etc…

SEND Intent

Here we are going to create a very simple app that will make itself available to a very specific Intent via Android Intent Filters. The app will present itself in the Intent list anytime we click on a link that is destined to This app was inspired by a Q&A entry that requested this exact behavior.

Let’s first look at the code for our app. We’re simply going to display a label to the user that tells them we know they just clicked on a link to Nothing fancy here.


If you build and run it, your output should look roughly like this:

app output

Custom AndroidManifest.xml

In order for our Appcelerator app to leverage Intent Filter functionality, we need to make a few changes to our AndroidManifest.xml. As you may or may not know, unless you define a custom AndroidManifest.xml file for your project, Titanium Studio will generate a new one for you on each build. Here’s how you create a persistent manifest that you can manage yourself.

  1. Create a default mobile project in Titanium Studio.
  2. Replace the existing app.js code with the code above.
  3. Build and run your app on either an Android device or emulator.
  4. In your project’s root directory create a platform/android directory
  5. Go to your project’s build/android directory and copy AndroidManifest.xml
  6. Paste the AndroidManifest.xml into your newly create platform/android directory

In the end, your project structure in Titanium Studio should look something like this:

Titanium Studio Project Structure

OK, now you have a custom AndroidManifest.xml that will persist between builds. We can now make the necessary changes to allow it to receive Intents from other Android apps.

Open up your custom AndroidManifest.xml and find the main activity for your app. It should be directly under the <!-- TI_APPLICATION --> comment. As you can see, it already includes an Intent Filter for launching the app. We are going to add one more to handle links to


Very briefly, the data subelement tells the intent-filter that we are handling for HTTP requests targeted at the host The 2 category subelements tell Android that we want to receive implicit Intents and that they can come from the browser, respectively. Finally, action states that we will be handling VIEW intents. For more information on the specifics of Intents and Intent Filters, be sure to check the Android developer documentation on the subject.

You now have an app that is ready to receive Intents. Install it on either an Android device or emulator and make sure it runs. Now you can test the Intent Filter by doing the following:

  1. Open your Android browser
  2. Search for “appcelerator” on
  3. Click the link for

You should be greeted with an Intent list that looks something like this:

Intent list

Select your app in the list and you will then be directed to your app containing the “I’ll bet you just clicked on a link to” label.

Sample Project

Download the full Intent Filter Test project at the Appcelerator Documentation Examples Github repository

Helpful Links

Android Dev Guide: Intents and Intent Filters

0 Flares Twitter 0 Facebook 0 LinkedIn 0 Email -- 0 Flares ×


  1. Danny

    This is awesome. It’s responses like these that make me happy I decided to go with Titanium for my mobile dev solution.

    I’m interested to know if it is possible to force the action into the app, rather than ask the user which application to open?

  2. Greg

    clear and helpful. Thanks for this!

  3. @Danny: I don’t believe you can force it, but the user has the opportunity to select “always” when opening the URL with your app the first time

  4. Jakub

    How should it look for catch gallery ‘share’ image? How to create Manifest and where in app catch this call?

  5. @Jakub: Add the following to your AndroidManifest.xml inside the main activity as above:

    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />

  6. Oscar

    @Tony: I tried that but don’t know how to catch the image then. My App is listen when I press ‘share’ on a gallery image but I haven’t found a way to find the image.

    I thought it would be something like:

    intent.getStringExtra(‘imageUri’) ?

  7. @Tony and @Oscar,

    I am having the same issue (can’t get any information about the intent). I tried to even take a step back and figure out how to determine the initiator of the Activity since this intent-filter is only one of the entry points into my app… but no success so far:

    Any help would be greatly appreciated! Thanks!

  8. Oscar


    Do you know how to catch the image? Is it send bij reference or is the blob in the intent somewhere?


  9. Vikas

    I am not able to find your Intent Filter Test project. Could you please help me to locate it?
    I am having issue in putting the intent-filter.
    This is what I am adding to my android manifest.

Comments are closed.

Sign up for our blog!

computer and tablet showing Appcelerator software
Start free, grow from there.
0 Flares Twitter 0 Facebook 0 LinkedIn 0 Email -- 0 Flares ×