How to create an Icon for your Live wallpaper?

Discussion in 'Archive - LWC 2.1' started by Keen, May 8, 2013.

  1. Keen Keeps coming back

    Member Since:
    Apr 30, 2013
    Message Count:
    16
    Likes Received:
    3
    Trophy Points:
    10
    Hello everyone, I'm wondering how we go about making an icon for our live wallpaper on the home screen? I'm finding that after the user install my wallpaper there's a lot of them who just forget that they even installed it on there. Seems to happen more often than not on the larger wall papers. anybody got any idea?
  2. Vas Origin

    Member Since:
    Jan 4, 2012
    Message Count:
    770
    Likes Received:
    175
    Trophy Points:
    500
  3. Keen Keeps coming back

    Member Since:
    Apr 30, 2013
    Message Count:
    16
    Likes Received:
    3
    Trophy Points:
    10
    yep I checked that one out already, doesn't that one only the settings menu? it doesn't go to the live wallpaper itself where they can actually see it and set it i think.
  4. James Rebello Active Member

    Member Since:
    Mar 28, 2013
    Message Count:
    70
    Likes Received:
    31
    Trophy Points:
    50
    You can create an activity for your wallpaper and add the below code to a button.This will bring up the preview screen directly
    Note this only applies to API level 16 or greater

    Code (text):
    public void onClick(View view) {
      Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
      intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
        new ComponentName(this, MyWallpaperService.class));
      startActivity(intent);
    }
    For lower versions, you can use the following code. This will bring up the live wallpaper chooser

    Code (text):
    public void onClick(View v) {
            Intent intent = new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
              startActivity(intent);
        }
    Keen likes this.
  5. Keen Keeps coming back

    Member Since:
    Apr 30, 2013
    Message Count:
    16
    Likes Received:
    3
    Trophy Points:
    10
    Thanks james for your help, but how would one add that to the manifest and code itself? I'm still pretty new to android development so, not sure where to go from there.
  6. James Rebello Active Member

    Member Since:
    Mar 28, 2013
    Message Count:
    70
    Likes Received:
    31
    Trophy Points:
    50
    You can add the second activity code mentioned below in your manifest file insdie the application tag
    Code (text):
         <application
            android:label="@string/application_name"
            android:icon="@drawable/icon">
     
            <service
                android:label="@string/service_name"  
                android:name="com.james.backgrounddemo.SBLiveWallpaper"
                android:permission="android.permission.BIND_WALLPAPER">
                <intent-filter>
                    <action android:name="android.service.wallpaper.WallpaperService" />
                </intent-filter>
                <meta-data android:name="android.service.wallpaper" android:resource="@xml/lwp_resource" />
            </service>
           
            <activity
                android:label="Settings"
                android:name="com.james.backgrounddemo.LiveWallpaperSettings"
                android:theme="@android:style/Theme.WallpaperSettings"
                android:exported="true">
            </activity>
           
            <activity
                android:name="com.james.backgrounddemo.MainActivity"
                android:label="Main" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
     
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
     
        </application>
     
    Just replace the package name and MainActivity class name with your activity in the android:name section.

    As for the activity you would have to design it and place a buuton inside it. You would have to check some android tutorials to do that.
    Below is a link to a list of Android tutorials on youtube:
    https://www.youtube.com/playlist?list=PLB03EA9545DD188C3
  7. Eraste Seasoned Vet

    Member Since:
    Jan 26, 2013
    Message Count:
    159
    Likes Received:
    76
    Trophy Points:
    100
    Did you get it to work without pointing users to the settings menu? We need feedback! lol
  8. Keen Keeps coming back

    Member Since:
    Apr 30, 2013
    Message Count:
    16
    Likes Received:
    3
    Trophy Points:
    10
    nah i didnt unfortunately... i just settled with the tutorial that you made D=

Share This Page