[TIMOB-1267] Android: Allow Setting HomeScreen Wallpaper
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-05-04T10:55:58.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.7.0, Sprint 2011-18 |
Components | Android |
Labels | android, feature, release-1.7.0, rplist |
Reporter | Don Thorp |
Assignee | Bill Dawson |
Created | 2011-04-15T02:48:07.000+0000 |
Updated | 2011-05-04T10:55:58.000+0000 |
Description
Feature request.
Comments
- 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.
- Don Thorp 2011-04-15
Moving out of future into TBS.
- 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...
- 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...
- 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.
- Don Thorp 2011-05-03 The permission for set wallpaper isn't being added. I used your test app in a new project.
- Bill Dawson 2011-05-04 Added wallpaper permission code to builder.py
- Don Thorp 2011-05-04 Tested on Nexus One 2.3.3