[英]Android AIDL Service not executing
I use Android Automotive 11 environment, The below code actually also does not run under Regular Android 11 environemnt.我使用 Android Automotive 11 环境,下面的代码实际上也不能在常规 Android 11 环境下运行。
I Use the emulator that I've built from source Android 11 r35.我使用从源代码 Android 11 r35 构建的模拟器。
When I try to open the AIDL service I get the following error:当我尝试打开 AIDL 服务时,出现以下错误:
PermissionMonitor: NameNotFoundException PermissionMonitor:NameNotFoundException
BroadcastQueue: Background execution not allowed BroadcastQueue:不允许后台执行
Here is the code:这是代码:
public class MySimpService extends Service {
@Override
public void onCreate() {
super.onCreate();
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return new SimpServiceImp();
}
}
SimpServiceImp Class: SimpServiceImp Class:
public class SimpServiceImp extends ISimp.Stub {
@Override
public int add(int a, int b) throws RemoteException {
return a+b;
}
@Override
public int sub(int a, int b) throws RemoteException {
return a-b;
}
}
AndroidManifest.xml AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AIDLService" >
<service android:name=".MySimpService">
<intent-filter>
<action android:name="com.example.aidlservice.MySimpService"/>
</intent-filter>
</service>
</application>
There were a lot of basic Android issues which made this not work.有很多基本的 Android 问题使得这不起作用。 Part of it is Service had to have Notification to keep alive.
部分原因是服务必须有通知才能保持活力。
https://github.com/NewstHet/AndroidAidlClient https://github.com/NewstHet/AndroidAIDLService https://github.com/NewstHet/AndroidAidlClient https://github.com/NewstHet/AndroidAIDLService
Github links contains working AIDL service using Android 11 API 30. Github 链接包含使用 Android 11 API 30 的工作 AIDL 服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.