Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在写在特定时间改变飞机模式的应用程序。
如何执行飞行模式切换?使用警报管理器还是什么?
在特定时间执行某事的最佳方式
在特定时间执行某事的唯一有效方法是使用AlarmManager, 带有RTC_WAKEUP警报类型和广播PendingIntent,您完全在其中完成工作onReceive()(BroadcastReceiver()如果它很短)或使用 aWakeLock和 aService来完成工作(或者可能我的WakefulIntentService)。
AlarmManager
RTC_WAKEUP
PendingIntent
onReceive()
BroadcastReceiver()
WakeLock
Service
WakefulIntentService