Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 安卓6.0广播接收器don';未接收到启动\u完成_Java_Android_Xml_Broadcastreceiver_Android 6.0 Marshmallow - Fatal编程技术网

Java 安卓6.0广播接收器don';未接收到启动\u完成

Java 安卓6.0广播接收器don';未接收到启动\u完成,java,android,xml,broadcastreceiver,android-6.0-marshmallow,Java,Android,Xml,Broadcastreceiver,Android 6.0 Marshmallow,我的接收器不能与安卓6.0棉花糖一起工作 我正在通过adb shell发送广播,见下文: adb外壳am广播-安卓系统.intent.action.BOOT_已完成收到 如果应用程序已打开,应用程序将显示:正在工作 但是如果应用程序没有打开,它就不会返回任何内容 我的代码在这里 AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.an

我的接收器不能与安卓6.0棉花糖一起工作

我正在通过adb shell发送广播,见下文:

adb外壳am广播-安卓系统.intent.action.BOOT_已完成
收到 如果应用程序已打开,应用程序将显示:正在工作

但是如果应用程序没有打开,它就不会返回任何内容

我的代码在这里

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.berate.rebootreceiverfromb3r0">
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" android:protectionLevel="signature|development"></uses-permission>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>


        </activity>

        <receiver android:name="com.example.berate.rebootreceiverfromb3r0.Yakala_Receiver">
                <intent-filter>
                    <category android:name="android.intent.category.DEFAULT"></category>
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                    <action android:name="android.intent.action.QUICKBOOT_POWERON" />
                </intent-filter>
            </receiver>
    </application>

</manifest>

编辑:我有非常有趣的信息,我的代码在三星(安卓6.0)设备上工作。但是我的(安卓6.0)设备没有响应我改变了这一点

<receiver android:name="com.example.berate.rebootreceiverfromb3r0.Yakala_Receiver">
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT"></category>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
            </intent-filter>
        </receiver>

对此

<receiver android:name="com.example.berate.rebootreceiverfromb3r0.Yakala_Receiver"  android:enabled="true" android:exported="true">
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT"></category>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
            </intent-filter>
        </receiver>

希望这有助于改变这种状况

<receiver android:name="com.example.berate.rebootreceiverfromb3r0.Yakala_Receiver">
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT"></category>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
            </intent-filter>
        </receiver>

对此

<receiver android:name="com.example.berate.rebootreceiverfromb3r0.Yakala_Receiver"  android:enabled="true" android:exported="true">
            <intent-filter>
                <category android:name="android.intent.category.DEFAULT"></category>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
            </intent-filter>
        </receiver>



希望它有帮助

我修正了,一些新的安卓设备默认有安全应用程序。有些时候,这些应用程序会锁定你的自动启动模式。

我修正了,一些新的android设备默认有安全应用程序。有时这些应用程序会锁定您的自动启动模式。

在您的接收器标签中添加android:enabled=“true”android:exported=“true”。检查您为什么指定android:protectionLevel?这是在您创建权限时,而不是在使用权限时。@JoxTraex我忘了删除它。我的代码没有protectionlevel,谢谢。请在您的接收器标签中添加安卓:enabled=“true”安卓:exported=“true”。检查您为什么指定android:protectionLevel?这是在您创建权限时,而不是在使用权限时。@JoxTraex我忘了删除它。我的代码没有protectionlevel,谢谢。你需要打开应用程序一次才能接收广播检查此以获取更多信息->谢谢你的回复,但我的问题不在这里,我正在打开应用程序,不删除。我正在关闭应用程序并尝试发送广播。我有非常有趣的信息,我的代码在三星(Android 6.0)设备上运行。但是我的(安卓6.0)设备没有响应我。您认为这是一个什么特殊问题?一些新的android设备默认有安全应用程序。有些时候,这些应用程序会锁定您的自动启动模式。请检查设置,它可能会阻止启动广播接收器?我检查了这个。我的手机没有安全应用程序。你需要打开应用程序一次才能接收广播检查此以获取更多信息->谢谢你的回复,但我的问题不在这里,我正在打开应用程序,不删除。我正在关闭应用程序并尝试发送广播。我有非常有趣的信息,我的代码在三星(Android 6.0)设备上运行。但是我的(安卓6.0)设备没有响应我。您认为这是一个什么特殊问题?一些新的android设备默认有安全应用程序。有些时候,这些应用程序会锁定您的自动启动模式。请检查设置,它可能会阻止启动广播接收器?我检查了这个。我的手机没有安全应用程序。你是如何修复的?我的手机有安全应用程序。我确实删除了安全应用程序,我的代码工作正常。你应该在手机上搜索第三方安全应用程序。你是如何修复的?我的手机有安全应用程序。我确实删除了安全应用程序,我的代码工作正常。您应该在手机上搜索第三方安全应用程序。