Skip to content

Custom Intents

Jim Roal edited this page Feb 9, 2019 · 13 revisions

How to create custom Intents for the auto-launch feature.

Note: Custom Android intents are cryptic and tricky to get set up correctly. This is a feature for advanced Android users. Be careful as strange things can happen.

What is an Intent?

Click this link: http://developer.android.com/guide/topics/intents/intents-filters.html for an overview of the Android Intent. It includes some examples and an explanation of the Action, Data, and Type fields.

A2DP Volume 2.0.9 and up includes a custom Intent builder. This can be used to launch an Intent when a device connects. To use this feature, click on a device in the device list on the main screen of A2DP Volume. A dialog box will pop up. Click the center Edit button in that dialog. Click the start app on connect button. A list of activity types will be shown. Select Custom Intent. The custom Intent builder screen will appear.

You must create an intent by filling in the action, data, and/or type correctly. You must test the intent before clicking the OK button. At least one of the fields must be filled in to test.

There is no validation so it is up to you to create and test your intent properly before storing it. This feature is really for the extra nerdy folks who understand Android programming.

Note: This feature was leveraged from App Alarm Pro. You can see documentation for App Alarm here: http://episode6.wordpress.com/2010/03/27/appalarm/

Note: You use either a package name or you set the action, data, and type fields but not both. If you use the "Custom Intent" makes you will not be setting the package. If you use the "Choose App" you will be setting only the package.

Examples

Tips

  • If you search the web you will find references to things like "Intent:ACTION_VIEW". That actually needs to be spelled out in this app to its constant value of "android.intent.action.VIEW". You can see the other intent constants here: https://developer.android.com/reference/android/content/Intent.html

  • Many intents may cause security exceptions now and cannot be used. As time goes on, more permissions are required to do more things.

  • The data field is read and parsed using Uri.parse(data field). You will see references to this Uri.parse function for custom intents. This custom intent feature will use the Uri.parse function for all text you enter in the data field. Just enter the text that the example shows as the parameter (URL). For instance, here is an example intent coded in Java.

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://almondmendoza.com/android-applications/"));

In this example just enter the "http://almondmendoza.com/android-applications/" part (no quotes) in the data field.

Here is an example of an intent to open a website:

Here is an example that will launch the default music player (Action = android.intent.action.MUSIC_PLAYER): When you connect and it launches this intent you will see something like this: Here you can choose the default player by selecting "always" so next time it will bypass this screen and just open the player.

Clone this wiki locally