I use Android Automotive 11 environment, The below code actually also does not run under Regular Android 11 environemnt.
I Use the emulator that I've built from source Android 11 r35.
When I try to open the AIDL service I get the following error:
PermissionMonitor: NameNotFoundException
BroadcastQueue: Background execution not allowed
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:
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
<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. Part of it is Service had to have Notification to keep alive.
https://github.com/NewstHet/AndroidAidlClient https://github.com/NewstHet/AndroidAIDLService
Github links contains working AIDL service using Android 11 API 30.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.