Intent Filter not working

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Intent Filter not working

Postby droozen » Wed Apr 08, 2009 6:08 pm

This is a duplicate post from Google Groups. Not sure if the people here also browse there or not...

Maybe this belongs in the beginners group, but I'm trying to make my
application available through an intent. It's a volume controller app,
so I figured it might be handy for another application to be able to
call it to adjust volume without having to write their own.

In my volume controller app, I have this activity as my main screen:

<activity android:name=".MainSettings" android:label="@string/
app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="intent.action.VOLUME_CONTROL"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

From another app, I call with:

Intent intent = new Intent();
intent.setAction("intent.action.VOLUME_CONTROL");
startActivity(intent);

Or I've tried:

Intent intent = new Intent("intent.action.VOLUME_CONTROL");
startActivity(intent);

Neither works. The process trying to call the other app fails. I've
also tried removing the category.DEFAULT category from my intent
filter, with no success.

What am I missing?
droozen
Developer
Developer
 
Posts: 45
Joined: Wed Feb 25, 2009 10:10 pm

Top

Postby Sowmya » Mon Apr 20, 2009 12:57 pm

Hi,
Are you getting this exception
android.content.ActivityNotFoundException: No Activity found to handle Intent { action=intent.action.VOLUME_CONTROL }

If you are not getting the exception, then its something do
with the action code you have created.
Hope this helps.
Sowmya
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Fri Mar 06, 2009 7:49 am

Postby droozen » Mon Apr 20, 2009 1:02 pm

Thanks. I actually ended up getting this working, though I still have no idea what I was doing wrong in the first place.
droozen
Developer
Developer
 
Posts: 45
Joined: Wed Feb 25, 2009 10:10 pm

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 5 guests