Android 6.0广播接收器未收到BOOT_COMPLETE [英] Android 6.0 Broadcast Receiver don't receive BOOT_COMPLETE

查看:67
本文介绍了Android 6.0广播接收器未收到BOOT_COMPLETE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的接收器无法与Android 6.0 Marshmallow一起使用.

My receiver is not working with Android 6.0 Marshmallow.

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

I am sending a broadcast through adb shell, see below:

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED 如果应用程序已打开,则应用程序说:正在工作!

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED received if application was open, App say:Working!

但是,如果应用程序未打开,则它不会返回任何内容.

But if the application was not open, it has not been returning anything.

我的代码在这里;

AndroidManifest.xml

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>

Receiver.Java;

Receiver.Java;

public class Yakala_Receiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Toast.makeText(context,"i got it ",Toast.LENGTH_SHORT).show();
    }
}

我有一个非常有趣的信息,我的代码正在三星(Android 6.0)设备上工作.但是我的(Android 6.0)设备没有响应我

I have very interesting info, My code is working on samsung (Android 6.0) devices. But my (Android 6.0) devices not responding me

推荐答案

我已修复,默认情况下,某些新的android设备具有安全应用程序.有时这些应用会锁定您的自动启动模式.

I fixed, some new android devices have security application by default. some times these apps lock your auto-start mode.

这篇关于Android 6.0广播接收器未收到BOOT_COMPLETE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆