在 iPhone 应用程序中,最耗电量的事情是什么?

发布于 2024-12-23 08:49:09 字数 186 浏览 3 评论 0原文

我正在制作一个会快速耗尽用户电池的应用程序。为此,我计划使用声音框架进行振动、定位服务、从互联网下载大而空的文件、使用手机背面的手电筒等等。 我知道这些可以有效地耗尽电池,但我想知道是否有更多方法消耗更多或同等的电量/处理器,或者可以以任何方式解决这个问题?

有关如何实现 100% CPU 使用率的示例也非常受欢迎。

谢谢。

I am making an app that quickly drains the users battery. For this, I am planning on using the sound-framework for vibrating, location services, download large but empty files from the internet, use the flashlight on the back of the phone, and so on.
I know these can effectively drain the battery, but I would like to know if there are more methods that are more or equally power/processor-consuming or that could work for this in any way?

Examples on how to achieve 100% CPU usage is also very appreciated.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不喜欢何必死缠烂打 2024-12-30 08:49:09

以下是您可以做的一些事情(其中大多数都可以通过编程方式完成。即,一旦您的应用程序启动,它们都可以一一打开) -

  1. 打开系统服务(不确定这是否可以通过编程方式
  2. 实现 )关于位置服务。即基于 GPS 的时区检测和其他最大。更新频率和不断移动手机以使 GPS 正常工作。
  3. 打开推送通知,间隔至少 15 分钟。
  4. 打开 iCloud 支持。
  5. 打开通知。
  6. 使屏幕亮度最高&将 iPhone 设置为不锁定。
  7. 打开 AirPlay(我见过的电池消耗最快的方法之一)。
  8. 打开 3G、Wi-Fi 无线电。
  9. 打开蓝牙收音机和连接到耳机。
  10. 通过内置扬声器播放音乐。
  11. 在您的应用程序中使用地图打开使用 GPS 的“定位我”功能。把 iPhone 留给它吧。
  12. 尝试获得 100% CPU 使用率(按照 Matthias 的建议)。但要小心,以免 watchDog 会毫不犹豫地关闭您的应用程序。
  13. 进行一些 OpenGL 渲染(按照 Matthias 的建议)。
  14. 打开您的 摄像头 LED 和保持开启。
  15. 打开设备中的所有传感器。加速度计、陀螺仪和设置它以便您的应用程序接收最多的更新,即保持更新间隔尽可能短&移动手机。

电池很可能会在 2 小时内耗尽。

一种使用线程实现 100% CPU 使用率的建议方法 - iPhone 3GS 上后台线程消耗 100% CPU 导致潜在主线程。但要小心...

Here are some of the things you could do (Most of these are possible to do programatically. i.e. they can all be turned on one by one as soon as your app starts) -

  1. Turn on System Services (Not sure this is possible programmatically)
  2. Turn on Location Services. i.e. GPS-Based Time Zone Detection & Others with max. update frequency & keep moving the phone around to get GPS working.
  3. Turn on Push notifications with minimum of 15 minute interval.
  4. Turn on iCloud support.
  5. Turn on Notifications.
  6. Make screen brightness highest & Set the iPhone not to lock.
  7. Turn on AirPlay (one of the fastest ways I have seen battery drain).
  8. Turn on the 3G, Wi-Fi radios.
  9. Turn on Bluetooth radios & connect to a headset.
  10. Play music through built-in speaker.
  11. Use maps in your app & turn on the “Locate Me” feature using GPS. Leave the iPhone to it.
  12. Try to get 100% CPU usage (as suggested by Matthias). But be careful, lest watchDog will shut your app down without second thought.
  13. Do some OpenGL rendering (as suggested by Matthias).
  14. Turn on your Camera LED & keep it on.
  15. Turn on all sensors in your device. Accelerometer, Gyroscope & set it so that your app receives maximum updates i.e. keep the update intervals shortest possible & move the phone around.

Most likely the battery will drain within 2 hours.

One suggested way for you to achieve 100% CPU usage using threading - Background threads consuming 100% CPU on iPhone 3GS causes latent main thread. But be careful...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文