0
  • 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.??

1 Answers1

0

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);
Guangyu Bai - MSFT
  • 2,555
  • 1
  • 2
  • 8