Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onClick(View v) {
Intent intent = new Intent("com.example.broadcasttest.LOCAL_BROADCAST");
//如果要在android8上边发送静态广播,需加入Component参数(参数1是自定义广播的包名,参数2是自定义广播的路径)
intent.setComponent(new ComponentName("com.example.broadcasttest",
"com.example.broadcasttest.MyBroadcastReceiver"));
localBroadcastManager.sendBroadcast(intent); // 发送本地广播
}
});
Expand Down