简体   繁体   English

iOS在锁屏上显示消息

[英]iOS display message on lockscreen

One of our clients asked for this functionality: "Permanently display a message (or image) on the iPhone lockscreen". 我们的一位客户要求使用此功能:“在iPhone锁定屏幕上永久显示消息(或图像)”。

Our initial ideas were: 我们最初的想法是:

  • Changing the device lockscreen image: 更改设备锁屏图像:
    • Couldn't find a solution for doing this. 找不到解决方案。 Couldn't find even a private API for it. 甚至找不到专用的API。
  • Playing an audio in background and display an album artwork. 在后台播放音频并显示专辑插图。 It has a few problems: 它有一些问题:
    • We cannot hide the volume and track buttons 我们无法隐藏音量和曲目按钮
  • Display a notification: 显示通知:
    • The notification will go away after the user skips the lockscreen 用户跳过锁定屏幕后,通知将消失

Any ideea how we can accomplish this request. 任何想法我们如何完成此请求。 Please note that the app is NOT intended to be distributed via AppStore. 请注意,该应用程序不打算通过AppStore分发。 This is an internal app only. 这仅是一个内部应用程序。 It should work on NON-Jailbreak devices through . 它应通过,在非越狱设备上工作 The app will be enterprise distribuited. 该应用程序将由企业分发。

Kind regards, 亲切的问候,

Artwork 艺术品

If it's not intended for the app store, you could definitely use the artwork thing. 如果不打算用于应用商店,则可以使用艺术品。 Since you don't need to comply with the iOS guidelines, just warn your users that the lockscreen buttons won't work if you try using them. 由于您不需要遵守iOS准则,因此请警告您的用户,如果您尝试使用锁屏按钮,则锁屏按钮将无法使用。 This link and this one should help. 链接 ,这一个应该有所帮助。

Using the iOS 7 background fetch can help you manage messages display, as long as the app has already been opened once. 只要应用程序已经打开一次,使用iOS 7 后台抓取就可以帮助您管理消息显示。 To know if the app is opened, you can send ping to your server saving the current app state every X minutes. 要知道该应用程序是否已打开,您可以每隔X分钟将ping发送到您的服务器,以保存当前应用程序状态。 If the server doesn't receive an update, it will just guess that the app is not running, he'll send emails or push notifications to the user until he does so. 如果服务器未收到更新,它将仅猜测该应用程序未在运行,他将向用户发送电子邮件或推送通知,直到他这样做为止。

Issues: 问题:

  • If the user opens an app like Music or any other that can become a responder, it will override your message. 如果用户打开“音乐”之类的应用程序或其他任何可以成为响应者的应用程序,它将覆盖您的消息。
  • You can only display a message if the app is opened at least once. 如果该应用程序至少打开一次,则只能显示一条消息。

Remote notifications 远程通知

It could be a good option since a notification can stay on the lockscreen as long as the user or you doesn't clear the notification center (you have to set it). 这可能是一个不错的选择,因为只要用户或您不清除通知中心(必须进行设置),通知就可以保留在锁屏上。 And you can remotely display any message without the app being launched. 而且,您可以在不启动应用程序的情况下远程显示任何消息。

Issues: 问题:

  • You have no way of knowing if he cleared the notification. 无法确定他是否清除了通知。 An idea would be to send them an email if notifications have been disabled . 一个想法是如果禁用了通知,则向他们发送电子邮件。
  • Users can just disable notifications. 用户可以仅禁用通知。

Lockscreen image 锁屏图像

You won't be able to change the device lockscreen image without a jailbroken device. 没有越狱的设备,您将无法更改设备的锁屏图像。


I'd go with the first one, if it's a client requirement it seems like a reliable one. 我会选择第一个,如果这是客户要求,那似乎是一个可靠的要求。 It all depends on how much control they have on the devices. 这完全取决于他们对设备的控制程度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM