【问题标题】:Not allowed to start service Intent without permission not exported from uidNot allowed to start service Intent without permission notexported from uid
【发布时间】:2017-01-07 07:45:33
【问题描述】:

我试图在我的 android 应用程序中调用第 3 方服务意图,但它返回错误:

java.lang.SecurityException: Not allowed to start service Intent { act=com.othercompany.SERVICE_INTENT flg=0x3 cmp=com.mycompany.package/com.othercompany.service.CoreService (has extras) } 未经许可未导出来自 uid 10107

我尝试调用的服务意图完全在我的应用程序之外,因此我无法访问其代码或清单文件。

我的代码如下:

        buttonPress.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent talkButtonDown = new Intent(PRESS_CLASS);
            talkButtonDown.setClassName(PACKAGE, "com.othercompany.service.CoreService");
            talkButtonDown.putExtra(RESTART_EXTRA, true);
            talkButtonDown.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            talkButtonDown.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
            startService(talkButtonDown);
        }
    });

我在其他帖子中阅读了有关在外部应用程序的清单中需要“exported=true”的信息,但我无权访问此清单。 还有其他可能引发此错误的东西吗?任何帮助将不胜感激。 干杯。

【问题讨论】:

    标签: java android android-intent intentservice


    【解决方案1】:

    还有什么可能引发这个错误的吗?

    没有。该服务未导出。它仅供托管服务的应用程序使用,不供其他应用程序直接调用。

    您可以考虑与相关公司联系,看看他们是否有文档化且受支持的 API 可用于处理他们的 Android 应用。

    【讨论】:

    • 嗯,我希望不是这样。我会联系开发人员并确保他们一切正常。非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多