IPC between 2 Android apps developed using Xamarin.Android is throwing an exception at the Mon Framework layer with the below message. Any help in this regards is highly appreciated:
System.NotSupportedException: Unable to activate instance of type ClientApplication.AddtionServiceConnnection from native handle 0xbf950b2c (key_handle 0x45f1f2d). ---> System.MissingMethodException: No constructor found for ClientApplication.AddtionServiceConnnection::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
--- End of inner exception stack trace ---
at Java.Interop.TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00054] in <e975227ac8644a30bb0866117325de0d>:0
at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <e975227ac8644a30bb0866117325de0d>:0
--- End of inner exception stack trace ---
Below is my AIDL contents:
package com.ServerApp.AddFunction;
interface IAdditionService
{
int Add(in int n1,in int n2);
}
public class AddtionServiceConnnection :IAdditionServiceStub, IServiceConnection
{
public void Dispose()
{
//throw new NotImplementedException();
}
public IAdditionService AddtionService { get; private set; }
public void OnServiceConnected(ComponentName name, IBinder service)
{
AddtionService = IAdditionServiceStub.AsInterface(service);
MainActivity.Instance.MyService = AddtionService;
MainActivity.Instance.IsBound = AddtionService != null;
}
public void OnServiceDisconnected(ComponentName name)
{
MainActivity.Instance.MyService = null;
MainActivity.Instance.IsBound = false;
}
public override int Add(int n1, int n2)
{
return AddtionService.Add(n1,n2);
}
public IntPtr Handle { get; }
}
}
Below is the android manifest of the application providing the service:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ServerApp.AddProgram" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" />
<application android:allowBackup="true" android:label="@string/app_name"></application>
<service android:name=".AdditionService"/>
</manifest>