首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Android 11上,从客户端应用程序调用远程绑定服务绑定失败

在Android 11上,从客户端应用程序调用远程绑定服务绑定失败
EN

Stack Overflow用户
提问于 2021-03-18 12:29:20
回答 2查看 1K关注 0票数 3

安卓11上,远程绑定服务绑定在从客户端应用程序调用时失败

问题仅限于Android 11。

1:使用带有AIDL接口的远程绑定服务的。此服务来自服务B,该服务还使用AIDL接口。

代码语言:javascript
复制
public class IPCEnterpriseServicePcsc extends IPCServicePcsc {
    ...
    protected IPCEnterpriseInterfaceLicense licenseBinder;
    ...
}

public class IPCEnterpriseInterfaceLicense extends IRemotePcscServiceLicense.Stub {...}

public class IPCServicePcsc extends IPCService {
        ...
    protected IPCInterfacePcsc mBinder;
    ...
}

public class IPCInterfacePcsc extends IRemotePcscService.Stub{...}

下面的2.是定义服务的服务器应用程序的说明:

代码语言:javascript
复制
    <service android:label="@string/pcsc_service_name" android:name=".IPCEnterpriseServicePcsc" >
        <intent-filter>
            <action android:name="com.baimobile.android.enterprise.credential.service.ipc.action.BIND_PCSC" />
            <action android:name="com.baimobile.android.enterprise.credential.service.ipc.action.BIND_LICENSE" />
            <action android:name="com.baimobile.android.enterprise.credential.service.license.action.VALIDATE_USER_LICENSE_INFO" />
        </intent-filter>
    </service>

server app id is "com.baimobile.android.enterprise.credential.service"

来自客户端应用程序的3.1,服务'IPCEnterpriseServicePcsc‘被调用如下:

意图=新的Intent("com.baimobile.android.enterprise.credential.service.ipc.action.BIND_LICENSE");intent.setPackage("com.baimobile.android.enterprise.credential.service");intent.putExtra(“接口”、"IRemotePcscServiceLicense");

布尔pcscServiceInstalled =appContext.bindService(意图,connectionToPcscInterface,Context.BIND_AUTO_CREATE);

3.2: connectionToPcscInterface定义为:

代码语言:javascript
复制
private ServiceConnection connectionToPcscInterface = new ServiceConnection() {
    public void onServiceConnected(ComponentName remoteComponent, IBinder binder) {...};
    public void onServiceDisconnected(ComponentName arg0) {..};
}

3.3:在步骤3.1中使用成功的appContext.bindService(),步骤3.2中指导的onServiceConnected()由服务调用。这里我们正在进行一些验证,然后绑定到基类服务IPCServicePcsc。

代码语言:javascript
复制
    Intent intent = new Intent("com.baimobile.android.pcsclite.service.ipc.action.BIND_PCSC");
    intent.setPackage("com.baimobile.android.enterprise.credential.service");
    intent.putExtra("Interface","IRemotePcscService");          // Request the PC/SC interface instead of the license interface.
    pcscServiceInstalled = appContext.bindService(intent, connectionToPcscInterface, Context.BIND_AUTO_CREATE);
    if( ! pcscServiceInstalled ){
        Log.e("TAG","bindService failed.");
    }

问题陈述:直到Android10,客户端应用程序能够很好地连接这些服务,但是在Android11上,绑定步骤3.3失败。

任何知道什么可能是问题,并寻找建议,以排除它。在Android 11上,似乎有什么东西坏了或者变硬了。

EN

Stack Overflow用户

发布于 2021-03-23 10:57:38

谢谢CommonsWare!你的建议帮助解决了这个问题。

为了在查询中使用AndroidManifest.xml,必须进行升级,

  1. AndroidStudio到4.1.3 (之前是3.x.x)
  2. Gradle版本到6.5 (gradle-wrapper.properties):distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip
  3. Android插件到4.1.0 (项目build.gradle)类路径'com.android.tools.build: gradle :4.1.0‘
票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66691117

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档