AnyChat技术支持论坛
标题:
ios的视频客户端有没有自动锁屏功能
[打印本页]
作者:
lincy
时间:
2017-4-28 16:24
标题:
ios的视频客户端有没有自动锁屏功能
如题
谢谢!
作者:
佰锐科技-梁国桦
时间:
2017-4-28 17:23
你好,我们demo在视频过程不会自动锁屏
作者:
lincy
时间:
2017-4-28 17:27
哦,问错了,是要问:是否有监听手机锁屏的代码
作者:
lincy
时间:
2017-4-28 17:31
** 警告⚠️ 该锁屏方法自2017-04月份开始被设定为私有API 调用后影响上线 报错“二进制文件不可用” 请谨慎使用 **
// 判断锁屏
#import <notify.h>
#define NotificationLock CFSTR("com.apple.springboard.lockcomplete")
#define NotificationChange CFSTR("com.apple.springboard.lockstate")
#define NotificationPwdUI CFSTR("com.apple.springboard.hasBlankedScreen")
- (BOOL)application
UIApplication *)application didFinishLaunchingWithOptions
NSDictionary *)launchOptions {
// 锁屏的通知监听
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),NULL, screenLockStateChanged,NotificationLock,NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),NULL, screenLockStateChanged,NotificationChange,NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
return YES;
}
//设备是否锁屏
staticvoid screenLockStateChanged(CFNotificationCenterRef center,void* observer,CFStringRef name,const void* object,CFDictionaryRef userInfo){
NSString* lockstate = (__bridgeNSString*)name;
if ([lockstateisEqualToString
__bridge NSString*)NotificationLock]) {
NSLog(@"锁屏");
}else{
NSLog(@"状态改变了");
}
}
anychat组件中是否有类似这些代码,监听手机锁屏?
欢迎光临 AnyChat技术支持论坛 (http://bbs.anychat.cn/)
Powered by Discuz! X3