简体   繁体   English

如何使用户知道应用程序在后台运行?

[英]How to keep user notified that application is running in background?

Since few days i am searching for the functionality which will allow me keep user posted that application is running in background. 由于几天以来,我一直在寻找可以让我随时向用户发布应用程序在后台运行的功能。 I have attached a !image for what exactly i am looking for. 我已附上一张图片! i tried googling but could not get exactly what I need. 我尝试使用Google搜索,但无法完全获得所需的信息。 when i tap on the flashing red bar it takes me back to the application. 当我点击闪烁的红色条时,它将带我回到应用程序。

Thanks in advance. 提前致谢。

图片

当前的iOS对第三方开发人员不支持您想要的通知类型。

If you want that kind of functionality then implement Apple Push Notification service through 如果您需要这种功能,请通过以下方式实施Apple Push Notification服务:

this you can first give message to Apple push notification service. 您可以首先向Apple推送通知服务发送消息。 then Apple service 然后是Apple服务

automatically generate notification for your App as you want. 根据需要自动为您的应用程序生成通知。

The red banner you pictured is provided by the system, is shown only if your application uses background audio recording (see AVAudioSession ), and doesn't provide the opportunity for you to choose what happens when the user taps it. 您所描绘的红色横幅是由系统提供的,仅当您的应用程序使用背景音频录制时才显示(请参阅AVAudioSession ),并且不会为您提供机会来选择用户点击时发生的情况。

Unless your app fits into one of a few specific classes , it doesn't actually "run" while in the background. 除非您的应用适合少数几个特定类别之一 ,否则它实际上不会在后台“运行”。 Instead, it's "suspended" -- still in memory, but gets no CPU time. 相反,它是“挂起”的-仍在内存中,但没有CPU时间。 What happens outside of your app is thus up to the system, not to you... the only way to show a banner that will launch your application is to use a push notification service or UILocalNotification , but those banners are only shown briefly, and you don't get to control their duration. 因此,应用程序外部发生的事情取决于系统,而不是您自己。...显示将启动您的应用程序的横幅的唯一方法是使用推送通知服务或UILocalNotification ,但是这些横幅仅会短暂显示,并且您不必控制他们的持续时间。 What you seem to be specifically asking for isn't possible using public API. 使用公共API似乎无法明确要求您。

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

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