Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1267] Android: Allow Setting HomeScreen Wallpaper

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-05-04T10:55:58.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.7.0, Sprint 2011-18
ComponentsAndroid
Labelsandroid, feature, release-1.7.0, rplist
ReporterDon Thorp
AssigneeBill Dawson
Created2011-04-15T02:48:07.000+0000
Updated2011-05-04T10:55:58.000+0000

Description

Feature request.

Comments

  1. Eric Beach 2011-04-15

    The ability to do this is one of the main reasons for my mobile development. Hope this can be escalated to some extent. Thanks.

  2. Don Thorp 2011-04-15

    Moving out of future into TBS.

  3. Bill Dawson 2011-04-15

    (from [f1f5cedd3d383687c571367bbdbfd18ddacbab03]) New Titanium.Media method to setSystemWallpaper, including apidoc. Also, change erroneous name "peakBounds" to "peekBounds". [#1267] https://github.com/appcelerator/titanium_mobile/commit/f1f5cedd3d383687c571367bbdbfd18ddacbab03"> https://github.com/appcelerator/titanium_mobile/commit/f1f5cedd3d38...

  4. Bill Dawson 2011-04-15

    (from [aaaa80fc7cb96429076e4054139b4c9077f6ceb4]) Move setSystemWallpaper from Ti.Media to Ti.Media.Android [#1267] https://github.com/appcelerator/titanium_mobile/commit/aaaa80fc7cb96429076e4054139b4c9077f6ceb4"> https://github.com/appcelerator/titanium_mobile/commit/aaaa80fc7cb9...

  5. Bill Dawson 2011-04-15

    QE Testing:

    You want to run this on a phone, so you can try the camera and if you have some photos in your Gallery on your phone, then that's good too.

    A good sample app.js:

       Titanium.UI.setBackgroundColor('#000');
       var win = Titanium.UI.createWindow({  
           title:'Test',
           backgroundColor:'#000',
           fullscreen:false,
           exitOnClose: true
       });
       var cb =function(data){
           var blob = data.media;
           Ti.API.info(blob);
           Ti.Media.Android.setSystemWallpaper(blob, true);
       };
       var err = function(e) {
           Ti.API.error(e);
       };
       var cancel =function() {
           Ti.API.warn('Cancelled');
       };
       
       var btn = Ti.UI.createButton({
           title: 'Camera',
           top: 0, height: "40dp", left: 0, right: 0
       });
       win.add(btn);
       btn.addEventListener('click', function(){
           Ti.Media.showCamera({
               success:cb,
               error: err,
               cancel: cancel
           });
       });
       
       var gallery = Ti.UI.createButton({
           title: 'Gallery',
           top: "45dp", height: "40dp", left: 0, right: 0
       });
       gallery.addEventListener('click', function(){
           Ti.Media.openPhotoGallery({
               success:cb,
               error:err,
               cancel:cancel
           });
       });
       win.add(gallery);
       
       var file = Ti.UI.createButton({
           title: 'File',
           top: "90dp", height: "40dp", left: 0, right: 0
       });
       file.addEventListener('click', function(){
           var f = Ti.Filesystem.getFile('KS_nav_ui.png');
           var blob = f.read();
           Ti.Media.Android.setSystemWallpaper(blob, true);
       });
       win.add(file);
       
       win.open();
       

    Run the app, and you can try three different ways of setting the homescreen wallpaper -- one by using the camera directly, one by selecting an existing photo from the Gallery, and one by setting it from the filesystem (just using the ugly KS_nav_ui.png file that is by default in your project's Resources folder.

    NOTE: When you take a photo or select from the gallery, don't be surprised if it takes a minute before the homescreen wallpaper actually gets updated. The system doesn't necessarily do it immediately.

  6. Don Thorp 2011-05-03

    The permission for set wallpaper isn't being added. I used your test app in a new project.
  7. Bill Dawson 2011-05-04

    Added wallpaper permission code to builder.py
  8. Don Thorp 2011-05-04

    Tested on Nexus One 2.3.3

JSON Source