Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make activity appear in the 'wallpaper chooser'

I want my activity to appear in the list of activities (gallery. live wallpapers, etc) that you see when you try to choose a wallpaper from the home screen.

Im assuming this is done with intents but cant seem to find one that works. The closest one I can find is:

<action android:name="android.intent.action.ACTION_SET_WALLPAPER>

but that doesn't work and seems to be used for something else.

like image 585
Kman Avatar asked Sep 25 '10 06:09

Kman


2 Answers

This should be the intent-filter you want:

<intent-filter>
    <action android:name="android.intent.action.SET_WALLPAPER" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Defined here: http://developer.android.com/reference/android/content/Intent.html#ACTION_SET_WALLPAPER

(The DEFAULT category is a standard syntax for intents.)

like image 175
hackbod Avatar answered Oct 01 '22 18:10

hackbod


The list under 'select wallpaper from' dialogue box that pops up when you click 'wallpapers' from the homescreen has three entries on most phones (I checked stock and HTC Sense):

  • Live wallpapers
  • Gallery
  • Wallpapers (or: HTC wallpapers)

When I press 'wallpapers' from the homescreen on HTC Sense I get:

09-26 20:17:58.901: INFO/ActivityManager(104): Starting activity: Intent { act=android.intent.action.SET_WALLPAPER_DIALOG cmp=com.htc.launcher/.WallpaperChooserDialog (has extras) }
09-26 20:17:59.301: INFO/ActivityManager(104): Displayed activity com.htc.launcher/.WallpaperChooserDialog: 353 ms (total 353 ms)

When on stock:

09-26 20:19:41.231: INFO/ActivityManager(86): Starting activity: Intent { act=android.intent.action.CHOOSER cmp=android/com.android.internal.app.ChooserActivity (has extras) }
09-26 20:19:41.571: INFO/ActivityManager(86): Displayed activity android/com.android.internal.app.ChooserActivity: 294 ms (total 294 ms)

And when I click through on 'wallpapers' when on stock:

09-26 20:19:51.101: INFO/ActivityManager(86): Starting activity: Intent { act=android.intent.action.SET_WALLPAPER flg=0x3000000 cmp=com.android.launcher/com.android.launcher2.WallpaperChooser }
09-26 20:19:51.581: INFO/ActivityManager(86): Displayed activity com.android.launcher/com.android.launcher2.WallpaperChooser: 463 ms (total 463 ms)

You need to use android.intent.action.SET_WALLPAPER. Maybe you forgot some other implementation details such as

<category android:name="android.intent.category.DEFAULT" /> 

so the chooser could pick it up? Have a look at Photostream's source code (http://code.google.com/p/apps-for-android/source/browse/trunk/#trunk/Photostream). Romain Guy has it working.

like image 32
pjv Avatar answered Oct 01 '22 18:10

pjv