我需要访问 android getSystemService 以在通知代码中设置警报。
我能否将 getSystemService 传递给广播接收器? 如果不是,我如何在广播接收器的代码中设置警报?
最佳答案
使用来自 onReceive(Context context, Intent intent)
的上下文
获取系统服务context.getSystemService(ALARM_SERVICE)
关于Android BroadcastReceiver 设置闹钟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45129576/