Android 我的广播接收器是显式的还是隐式的?

Android 我的广播接收器是显式的还是隐式的?,android,android-broadcastreceiver,Android,Android Broadcastreceiver,在阅读了一些手册(,)之后,我仍然需要帮助。我把我的应用定位在安卓O上,在安卓7.0上运行良好,但在8.1上,我似乎没有收到任何广播。那么,如果在manifest中以androido为目标,在7.0上运行,并使用隐式广播,它还能工作吗? 你能帮我确定我的广播是显性的还是隐性的吗? 我正在使用API 舱单: <receiver android:name=".DetectionBroadcastReceiver" > <intent-filter>

在阅读了一些手册(,)之后,我仍然需要帮助。我把我的应用定位在安卓O上,在安卓7.0上运行良好,但在8.1上,我似乎没有收到任何广播。那么,如果在manifest中以androido为目标,在7.0上运行,并使用隐式广播,它还能工作吗? 你能帮我确定我的广播是显性的还是隐性的吗? 我正在使用API

舱单:

   <receiver android:name=".DetectionBroadcastReceiver" >
        <intent-filter>
            <action android:name="childincar.com.michlindevelopment.DETECTIONFENCE" />
        </intent-filter>
    </receiver>
康斯坦斯

public class Constans {
    public static final String FENCE_RECEIVER_ACTION = BuildConfig.APPLICATION_ID + ".DETECTIONFENCE";
}
登记

 public static void registerFences(final Context context) {

        Intent intent = new Intent(Constans.FENCE_RECEIVER_ACTION);
        PendingIntent mPendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);


        Awareness.getFenceClient(context).updateFences(new FenceUpdateRequest.Builder()
                .addFence(Constans.DETECTION_FENCE_DRIVING, DetectedActivityFence.starting(DetectedActivity.IN_VEHICLE), mPendingIntent)
                .addFence(Constans.DETECTION_FENCE_WALKING, DetectedActivityFence.starting(DetectedActivity.WALKING), mPendingIntent)
                .build())
                .addOnSuccessListener(new OnSuccessListener<Void>() {
                    @Override
                    public void onSuccess(Void aVoid) {

                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {

                    }
                });
    }
公共静态无效注册表项(最终上下文){
意向意向=新意向(康斯坦斯围栏、接收器、行动);
pendingent mpendingent=pendingent.getBroadcast(上下文,0,意图,0);
Awareness.getFenceClient(context.updateFences)(新FenceUpdateRequest.Builder()
.addFence(Constans.DETECTION\u FENCE\u驾驶,Detected Activity FENCE.启动(Detected Activity.IN\u车辆),mpendingent)
.addFence(Constans.DETECTION\u FENCE\u WALKING,Detected Activity FENCE.Start(Detected Activity.WALKING),mpendingContent)
.build())
.addOnSuccessListener(新的OnSuccessListener(){
@凌驾
成功时公开作废(作废避免){
}
})
.addOnFailureListener(新的OnFailureListener(){
@凌驾
public void onFailure(@NonNull异常e){
}
});
}

任何对您的应用程序“特定”的广播都是隐式的。例如,“ACTION_MY_PACKAGE_REPLACED”的广播接收器特定于您的应用程序,应该是显式的,“ACTION_PACKAGE_REPLACED”是隐式的,因为它会通知您所有软件包


您的广播接收器似乎是隐式的,因为它不仅仅是为“您的”应用程序而设计的。

那么我能做些什么呢?
 public static void registerFences(final Context context) {

        Intent intent = new Intent(Constans.FENCE_RECEIVER_ACTION);
        PendingIntent mPendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);


        Awareness.getFenceClient(context).updateFences(new FenceUpdateRequest.Builder()
                .addFence(Constans.DETECTION_FENCE_DRIVING, DetectedActivityFence.starting(DetectedActivity.IN_VEHICLE), mPendingIntent)
                .addFence(Constans.DETECTION_FENCE_WALKING, DetectedActivityFence.starting(DetectedActivity.WALKING), mPendingIntent)
                .build())
                .addOnSuccessListener(new OnSuccessListener<Void>() {
                    @Override
                    public void onSuccess(Void aVoid) {

                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {

                    }
                });
    }