We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在调试Android程序过程中,观察logcat的面板,会发现有红色警告出现 Sending non-protected broadcast com.space365.intent.broadcast.launcher from system 1291:com.space365.smartboard/1000 pkg com.space365.smartboard 不影响正常使用。不过有洁癖的我不开心
Sending non-protected broadcast com.space365.intent.broadcast.launcher from system 1291:com.space365.smartboard/1000 pkg com.space365.smartboard
看来我们又干了让系统不高兴的事情了。non-protected就是不安全的。
private void sendLaunchBroadcast( String message , LaunchStage stage) { LaunchInfo.INSTANCE.setStage(stage); Intent intent = new Intent(); intent.setAction(Broadcasts.launcher); intent.putExtra(Broadcasts.Launcher.message , message ); intent.putExtra( Broadcasts.Launcher.stage , stage.name() ); LocalBroadcastManager.getInstance(this.context).sendBroadcast( intent ); }
private void setupBroadcast() { IntentFilter filter = new IntentFilter(); filter.addAction(Broadcasts.launcher); LocalBroadcastManager.getInstance(this.requireContext()).registerReceiver((broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Logger.i("onReceive launcher Broadcast>>>>>>"); } }), filter); }
@Override public void onStop() { LocalBroadcastManager.getInstance(this.requireContext()).unregisterReceiver(broadcastReceiver); super.onStop(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
现象
在调试Android程序过程中,观察logcat的面板,会发现有红色警告出现
Sending non-protected broadcast com.space365.intent.broadcast.launcher from system 1291:com.space365.smartboard/1000 pkg com.space365.smartboard
不影响正常使用。不过有洁癖的我不开心
解决方案
看来我们又干了让系统不高兴的事情了。non-protected就是不安全的。
这个就不展开了,官网有介绍
简单讲下,因为我的实际使用广播的范围只是跨模块并没有出应用。所以用权限多少有点小题大做的感觉
通过LocalBroadcastManager来实现内部广播。三个点必须一起改,和原理的广播不兼容
The text was updated successfully, but these errors were encountered: