Android-job: Is it possible to make this available for Xamarin.Android?

Created on 20 Feb 2018  路  12Comments  路  Source: evernote/android-job

I would like to use this library in Xamarin.Android to cater for all the different Android versions. Now with Android 'O' rejecting the 'StartService(...)' method, It is needed to implement this project and to save battery power.

enhancement

Most helpful comment

All 12 comments

I don't have any experience with Xamarin, so I can't help you, sorry. Stackoverflow might be a better place to ask this question.

I will attempt at converting it to Xamarin.Android. Thank you

Okay, I have successfully created a Xamarin.Android dll.

  1. Cmd > gradlew.bat
  1. Cmd > gradlew build > Successful

  2. Follow these instructions:

  • Use the classes.jar file in ..\library\build\intermediates\intermediate-jars\release\classes.jar
    --Had to add these two lines to the Transform > Metadata.xml

    • <attr path="/api/package[@name='com.evernote.android.job.util']/class[@name='JobPreconditions']/method[@name='checkNotEmpty']/parameter[@name='p0']" name="name">refparam</attr>

    • <attr path="/api/package[@name='com.evernote.android.job.util']/class[@name='JobPreconditions']/method[@name='checkNotEmpty']/parameter[@name='refparam']" name="type">Java.Lang.CharSequence</attr>

  1. Include the output dll into the main project

  2. Done

I will test to see if it works

Great, It works in Xamarin.Android!

I have bound the library classes.jar file, needed to add Metadata to rename all the parameter names from p0, p1 to actual names. Added the proguard lines and the Android Manifest to my project with the Bound DLL, works like a charm.

If you would like to have the Xamarin Binding for this project, just give me a shout.

I don't know how this setup looks like and I wouldn't be able to maintain it. You can create your own Github repository and I could link it on the main page.

Awesome, I'll update the README later.

Thank you :)

I'm reopening the issue to keep in mind that I need to do it.

I've updated the FAQ https://github.com/evernote/android-job/wiki/FAQ#can-i-use-the-library-with-xamarin-android

Thanks Dooks, I will try your bindings tomorrow as the Firebase scheduler fails to cancel jobs and that causes obvious problems.

@Dooks123 Awesome man. I don't use Xamarin though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mohamadk picture mohamadk  路  6Comments

Haoxiqiang picture Haoxiqiang  路  3Comments

ruhul015 picture ruhul015  路  4Comments

georgikoemdzhiev picture georgikoemdzhiev  路  4Comments

ExploiTR picture ExploiTR  路  6Comments