[英]iPhone Development - Detect User activity
Can someone please tell me if the following is possible when building an iPhone application. 有人可以告诉我在构建iPhone应用程序时是否可以进行以下操作。
I simply want small application that does the following: 我只想要执行以下操作的小型应用程序:
Are there easy libraries to use to work out this information. 是否有易于使用的库来计算这些信息。
- Detects if the phone is being used so is the screen awake? -检测电话是否正在使用,屏幕是否唤醒?
It is not possible as it will violate the privacy of the user. 这是不可能的,因为它会侵犯用户的隐私。 Unless you are talking about detect if your app is being used actively on foreground, background, suspended mode and etc, then it is a Yes.
除非您要谈论检测是否在前景,背景,挂起模式等上积极使用您的应用程序,否则它是“是”。
Example of code:- 代码示例:-
UIApplicationState state = [[UIApplication sharedApplication] applicationState];
if (state == UIApplicationStateBackground || state == UIApplicationStateInactive){
//Do Something
}
else{
//Do Other thing
}
- Detect for active internet connection. -检测有效的互联网连接。
Yes, it is possible, I am using this https://github.com/tonymillion/Reachability 是的,有可能,我正在使用此https://github.com/tonymillion/Reachability
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.