android8開始發送給靜態廣播需要明確設置ComponentName 參數
/**
* 其中ComponentName(參數1,參數2)
* 參數1指的是你的app的包名,參數2指的是你的自定義廣播所在的路徑
*
*/
Intent intent = new Intent();
intent.setAction(MqReceiver.Mq_Message);
//寫法一
ComponentName componentName = new ComponentName("com.btzh.baidulocation","com.btzh.baidulocation.receiver.MqReceiver");
//寫法二
//ComponentName componentName = new ComponentName(this,"com.btzh.baidulocation.receiver.MqReceiver");
intent.setComponent(componentName);
sendBroadcast(intent);