Reputation: 45
I have service class implementation in Example.aar
public class DemoService : Service{}
I have created a Native binding library project.
When i tried to bind this service in Xamarin.Android project. bindService() is returning false.
var Result =context.getApplicationContext.bindService(new Intent(context,typeof(DemoService)), new ServiceConnection(),Bind.AutoCreate); //Result is false.
How to bind a service created in 3rd party library project in Xamarin Android project.??
Upvotes: 0
Views: 178
Reputation: 4486
You can refer to this article Binding a Java Library. In the Microsoft doc, first you can get the class from the .aar file.
var ClassName = new Com.MyCompany.MyProject.MyclassName();
Then use the bindService or other methods to use the Class.
var Result =context.getApplicationContext.bindService(new Intent(context,typeof(ClassName)), new ServiceConnection(),Bind.AutoCreate);
Upvotes: 0