我总是看到“ E ActivityManager:从系统发送不受保护的广播”在android 7中是什么意思? [英] I always see "E ActivityManager: Sending non-protected broadcast from system" in android 7. What does this mean?

查看:2439
本文介绍了我总是看到“ E ActivityManager:从系统发送不受保护的广播”在android 7中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下功能从非系统应用发送意图。

I am trying to send an intent from a non system app using the following function.

public static void sendIntent() {
        if (null != _context) {
            Intent intent = new Intent("com.test.testApp.testIntent");
            intent.setPackage(_context.getPackageName());
            _context.sendBroadcast(intent);
        }
    }

但是我总是看到来自ActivityManager的错误消息如下。相同的Intent Broadcast(app)在Andorid 6.0中工作正常,但在android 7.1.1中引发错误。我需要为android 7.1.1更改任何内容吗?

But I always see there is an error message from ActivityManager as below. The same intent broadcasting(app) works fine in andorid 6.0 but throws an error in android 7.1.1. I am required to change anything for android 7.1.1?

4-10 15:06:34.423 1615 2921 E ActivityManager:发送不受保护的广播com.test.testApp来自系统2886的.testIntent:com.test.testApp / u0a117 pkg com.test.testApp

4-10 15:06:34.423 1615 2921 E ActivityManager: Sending non-protected broadcast com.test.testApp.testIntent from system 2886:com.test.testApp/u0a117 pkg com.test.testApp

在ListFragment中,我按以下方式注册接收者:

In a ListFragment I register the receiver as follows:

 @Override
    public void onStart() {
        super.onStart();
        getActivity().registerReceiver((receiver),
                new IntentFilter(com.test.testApp.testIntent));
        TextView textDownload = (TextView) getActivity().findViewById(R.id.output);
        textDownload.setVisibility(android.view.View.INVISIBLE);
    }


推荐答案

这可能会有帮助,

如果您在AndroidManifest.xml中声明了 android:sharedUserId = android.uid.system,则声明受保护的广播。

If you have in your AndroidManifest.xml declared "android:sharedUserId="android.uid.system", then declare the protected broadcast.

参考资料: https://stackoverflow.com/a/50240471

这篇关于我总是看到“ E ActivityManager:从系统发送不受保护的广播”在android 7中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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