SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
ロック画面ハック
してみた
田村 航弥

@tamotamago
田村 航弥 @tamotamago
2014年 02 月 株式会社ミクシィを退職しました
mixi for iPhone

PoPolly
初級∼中級者向け 電子書籍 only 2 月発売予定
ロックスクリーンハック

on Android

youtube 動画
PoPolly for Android
iOS でごりってみた

youtube 動画
iOS でごりってみた
BackGround で

動きましょう
音楽ボタンのイベント
を拾いましょう

アートワークを

いじりましょう
BackGround で

動きましょう
音楽ボタンのイベント
を拾いましょう

アートワークを
いじりましょう
Background Modes
Background Modes
MPMoviePlayerController
MPMoviePlayerController
•

無音 MP3 をエンドレスループ

_moviePlayerController = [[MPMoviePlayerController alloc]
initWithContentURL:[[NSBundle mainBundle]
URLForResource:@"Silent3sec" withExtension:@“mp3"]];
!
_moviePlayerController.repeatMode = MPMovieRepeatModeOne;
AVAudioSession
AVAudioSession
•

バックグラウンドに移ったときの振る舞いを設
定

[[AVAudioSession sharedInstance] setDelegate: self];
NSError *error;
// Initialize the AVAudioSession here.
if (![[AVAudioSession sharedInstance]
setCategory:AVAudioSessionCategoryPlayback error:&error]) {
// Handle the error here.
NSLog(@"Audio Session error %@, %@", error, [error
userInfo]);
}

AVAudioSessionCategoryPlayback : ロックスクリーンに行っても出力の
みし続ける
BackGround
動きましょう
音楽ボタンのイベント
を拾いましょう

アートワークを
いじりましょう
RemoteControlEvents
RemoteControlEvents
これ
RemoteControlEvents
•

イベント受け取ります宣言

[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
RemoteControlEvents
•

イベント受け取り

- (void)remoteControlReceivedWithEvent:(UIEvent *)event
{
switch (event.subtype) {
case UIEventSubtypeRemoteControlPlay:
case UIEventSubtypeRemoteControlPause:
case UIEventSubtypeRemoteControlStop:
case UIEventSubtypeRemoteControlTogglePlayPause:
NSLog(@"pushed center button");
break;
case UIEventSubtypeRemoteControlNextTrack:
NSLog(@"pushed right button");
break;
case UIEventSubtypeRemoteControlPreviousTrack:
NSLog(@"pushed left button");
break;
default:
break;
}
}
RemoteControlEvents
// for UIEventTypeRemoteControl, available in iOS
UIEventSubtypeRemoteControlPlay
=
UIEventSubtypeRemoteControlPause
=
UIEventSubtypeRemoteControlStop
=
UIEventSubtypeRemoteControlTogglePlayPause
=
UIEventSubtypeRemoteControlNextTrack
=
UIEventSubtypeRemoteControlPreviousTrack
=
UIEventSubtypeRemoteControlBeginSeekingBackward =
UIEventSubtypeRemoteControlEndSeekingBackward
=
UIEventSubtypeRemoteControlBeginSeekingForward =
UIEventSubtypeRemoteControlEndSeekingForward
=

4.0
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
BackGround
動きましょう
音楽ボタンのイベント
を拾いましょう

アートワークを

いじりましょう
MPNowPlayingInfoCenter
MPNowPlayingInfoCenter
•

Now Playing な Information をセットできる

MPMediaItemArtwork *artwork = [[MPMediaItemArtwork alloc] initWithImage:[UIImage
imageNamed:@"question"]];
// set NowPlaying.
Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if (playingInfoCenter) {
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
center.nowPlayingInfo = @{};

!

}

NSDictionary *songInfo
= @{MPMediaItemPropertyTitle:@"どっちがすき?",
MPMediaItemPropertyArtwork:artwork,
MPMediaItemPropertyPlaybackDuration:[NSNumber numberWithDouble:20.0],
MPNowPlayingInfoPropertyElapsedPlaybackTime:[NSNumber numberWithDouble:0.0],
MPNowPlayingInfoPropertyPlaybackRate:[NSNumber numberWithDouble:1.0]
};
center.nowPlayingInfo = songInfo;

userInfo の key はMPNowPlayingInfoCenter.h に書いてあります
ボタンが押されたら

アートワークを変更する
みなさん何か忘れていませんか?
Apple Review Guideline
Apple Review Guideline

•

2.16 Multitasking Apps may only use
background services for their intended
purposes: VoIP, audio playback, location,
task completion, local notifications, etc.
結び
結び
作る前に(レビューガイドラインを)読む!

Contenu connexe

En vedette

Conference withdevelopers 第二版
Conference withdevelopers 第二版Conference withdevelopers 第二版
Conference withdevelopers 第二版Tamura Koya
 
Parse introduction
Parse introductionParse introduction
Parse introductionTamura Koya
 
第87回PHP勉強会 LT 知って得するかもしれないテキスト処理コマンドのお話
第87回PHP勉強会 LT 知って得するかもしれないテキスト処理コマンドのお話第87回PHP勉強会 LT 知って得するかもしれないテキスト処理コマンドのお話
第87回PHP勉強会 LT 知って得するかもしれないテキスト処理コマンドのお話Ryo Shibayama
 
WordPress on PHP7 on CentOS7 on Saraku-VPS
WordPress on PHP7 on CentOS7 on Saraku-VPSWordPress on PHP7 on CentOS7 on Saraku-VPS
WordPress on PHP7 on CentOS7 on Saraku-VPSRyo Shibayama
 
Amazon inspector で自動セキュリティ診断
Amazon inspector で自動セキュリティ診断Amazon inspector で自動セキュリティ診断
Amazon inspector で自動セキュリティ診断Ryo Shibayama
 
Security Advisories Checker on Travis/Circle CI
Security Advisories Checker on Travis/Circle CISecurity Advisories Checker on Travis/Circle CI
Security Advisories Checker on Travis/Circle CIRyo Shibayama
 
ElasticBeanstalk で新規事業を爆速ローンチする
ElasticBeanstalk で新規事業を爆速ローンチするElasticBeanstalk で新規事業を爆速ローンチする
ElasticBeanstalk で新規事業を爆速ローンチするRyo Shibayama
 

En vedette (8)

Conference withdevelopers 第二版
Conference withdevelopers 第二版Conference withdevelopers 第二版
Conference withdevelopers 第二版
 
Parse introduction
Parse introductionParse introduction
Parse introduction
 
第87回PHP勉強会 LT 知って得するかもしれないテキスト処理コマンドのお話
第87回PHP勉強会 LT 知って得するかもしれないテキスト処理コマンドのお話第87回PHP勉強会 LT 知って得するかもしれないテキスト処理コマンドのお話
第87回PHP勉強会 LT 知って得するかもしれないテキスト処理コマンドのお話
 
WordPress on PHP7 on CentOS7 on Saraku-VPS
WordPress on PHP7 on CentOS7 on Saraku-VPSWordPress on PHP7 on CentOS7 on Saraku-VPS
WordPress on PHP7 on CentOS7 on Saraku-VPS
 
Amazon inspector で自動セキュリティ診断
Amazon inspector で自動セキュリティ診断Amazon inspector で自動セキュリティ診断
Amazon inspector で自動セキュリティ診断
 
Severfield AGM Presentation
Severfield  AGM PresentationSeverfield  AGM Presentation
Severfield AGM Presentation
 
Security Advisories Checker on Travis/Circle CI
Security Advisories Checker on Travis/Circle CISecurity Advisories Checker on Travis/Circle CI
Security Advisories Checker on Travis/Circle CI
 
ElasticBeanstalk で新規事業を爆速ローンチする
ElasticBeanstalk で新規事業を爆速ローンチするElasticBeanstalk で新規事業を爆速ローンチする
ElasticBeanstalk で新規事業を爆速ローンチする
 

Lock Screen Hack