Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Curious to know the trick for live wallpapers on lock screen on iPhone

This application and this application says it displays live wallpapers on lock screen. We have similar requirement.

From reviews came to know that it is playing music in background with silent volume, but it is not relevant to setting wallpapers.

Totally bummer topic for us. Can anyone please suggest some point where to begin.. ?

Referred this and Referred this questions on our forum, but says that it won't be approved by Apple. So how does current application exist on store ?

Note: Please consider this as genuine programming questions as there is no starting point we can find.

like image 585
Janak Nirmal Avatar asked Feb 06 '12 06:02

Janak Nirmal


1 Answers

If you play music, you can use MPNowPlayingInfoCenter (Available in iOS 5.0 and later.) to set things like cover art, title and artist on the lock screen. Your code could look like this:

NSMutableDictionary *currentTrackData = [[NSMutableDictionary alloc] init];
[currentTrackData setObject:"Some text" forKey:MPMediaItemPropertyTitle];

MPMediaItemArtwork *mediaItemArtwork =[[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:@"your image path"]];
[currentTrackData setObject:mediaItemArtwork forKey:MPMediaItemPropertyArtwork];
[mediaItemArtwork release];

[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = currentTrackData;

Dont forget to import the media player framework:

#import <MediaPlayer/MediaPlayer.h>
like image 182
Thomas Kekeisen Avatar answered Nov 03 '22 09:11

Thomas Kekeisen