Android 每5分钟广播一次接收器,以获取wifi信号
朋友 我在这里和android方面都是新手。我想知道是否可以每5-10分钟接收一次Wifi信号,我听说我们可以使用广播接收器,但我不知道每5-10分钟刷新一次可以吗 谢谢你是的,你可以Android 每5分钟广播一次接收器,以获取wifi信号,android,android-broadcast,Android,Android Broadcast,朋友 我在这里和android方面都是新手。我想知道是否可以每5-10分钟接收一次Wifi信号,我听说我们可以使用广播接收器,但我不知道每5-10分钟刷新一次可以吗 谢谢你是的,你可以 AlarmManager service = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(context, StatusQueryServiceStar
AlarmManager service = (AlarmManager) context
.getSystemService(Context.ALARM_SERVICE);
Intent i = new Intent(context, StatusQueryServiceStartReceiver.class);
// Schedule the alarm!If there is already an alarm scheduled for the same IntentSender, it will first be canceled.
PendingIntent pending = PendingIntent.getBroadcast(context, 0, i,
PendingIntent.FLAG_CANCEL_CURRENT);
// InexactRepeating allows Android to optimize the energy consumption
service.setInexactRepeating(AlarmManager.RTC_WAKEUP,
0,//cal.getTimeInMillis(),
REPEAT_TIME, pending);
// service.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
// REPEAT_TIME, pending);
StatusQueryServiceStartReceiver是一个广播接收器您有两个选择,您可以体验网络的抽象状态以获取信息,无论您是否连接,以及是否使用移动或WiFi,请在此android中详细描述 或者您可以使用,它允许您:
- /无线网络
- 无线网络
- 特殊联系
- -手动使设备扫描WiFi网络
- 被设备检测到
- 还有更多