我试图在我的Android应用程序中调用第三方服务意图,但它返回错误:
java.lang.SecurityException:不允许启动服务Intent {act = com.othercompany.SERVICE_INTENT flg = 0x3 cmp = com.mycompany.package / com.othercompany.service.CoreService(has extras)}未经许可不从uid导出10107
The service intent I am trying to call is completely external to my application and therefore I cannot access its code or manifest files.
我的代码如下:
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',但我无法访问此清单 . 还有什么可以抛出这个错误吗?任何帮助将受到高度赞赏 . 干杯 .
1 回答
不 . 该服务不会导出 . 它专门供托管服务的应用程序使用,而不是直接调用其他应用程序 .
您可以考虑与相关公司联系,以了解他们是否拥有用于使用其Android应用的文档化和支持的API .