企业微信AI Agent:企微官方能力+企业微信服务商方案+AI SCRM选型指南解读
2026/6/26 17:54:41
/** * 注册屏幕广播监听器 */ private void registerScreenReceiver() { IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_SCREEN_ON); screenReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_SCREEN_OFF.equals(action)) { boolean hasMediaPlaying = checkMediaPlaying(); LogUtils.logd(TAG + " 屏幕熄灭 hasMediaPlaying: " + hasMediaPlaying+" >>>>>>>"+ StringUtils.convertNullOrEmptyWithDefault(context.getClass().getSimpleName(), "")); } else if (Intent.ACTION_SCREEN_ON.equals(action)) { LogUtils.logd(TAG + " 屏幕点亮"); // 处理亮屏逻辑 } } }; // 动态注册(无需在清单中声明) this.appContext.registerReceiver(screenReceiver, filter); } // 记得在不需要时注销(例如 Application.onTerminate() 很少调用,建议在合适的时机注销) public void unregisterScreenReceiver() { if (screenReceiver != null) { appContext.unregisterReceiver(screenReceiver); screenReceiver = null; } }