Hi Mathieu,
congratulations to this interesting concept !
I've tested it, and it seems an excellent approach !
But nevertheless, I've a problem in accessing the methods and fields, if I create my own java classes like your accelerometer example.
This is not the case, when I access normal Android Java Classes.
I'm able to get the names of my methods by a call to getClass().getDeclaredMethods() but they are not accessable via the dictionary of the class (like e.g. densityDpi in DisplayMetrics).
I believe I miss something during the jni process, but I can't imagine.
Here a short output what I mean - the first line is an output of autoclass('android.util.DisplayMetrics') and the next lines are an output of autoclass('org.renpy.android.Hardware'):
[INFO ] TEST: DisplayMetrics ['DENSITY_DEFAULT', 'DENSITY_DEVICE', 'DENSITY_HIGH', 'DENSITY_LOW', 'DENSITY_MEDIUM', 'DENSITY_XHIGH', '__class__', '__cls_storage', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__javaclass__', '__javaconstructor__', '__module__', '__new__', '__pyx_vtable__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'density', 'densityDpi', 'equals', 'getClass', 'hashCode', 'heightPixels', 'notify', 'notifyAll', 'scaledDensity', 'setTo', 'setToDefaults', 'toString', 'updateMetrics', 'wait', 'widthPixels', 'xdpi', 'ydpi']
[INFO ] TEST: Hardware ['__class__', '__cls_storage', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__javaclass__', '__javaconstructor__', '__module__', '__new__', '__pyx_vtable__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'equals', 'getClass', 'hashCode', 'notify', 'notifyAll', 'toString', 'wait']
[INFO ] TEST: getClass ['__class__', '__cls_storage', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__javaclass__', '__metaclass__', '__module__', '__new__', '__pyx_vtable__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'forName', 'getConstructors', 'getDeclaredFields', 'getDeclaredMethods', 'getFields', 'getMethods', 'getName']
[INFO ] TEST: getDeclaredMethods [<Method at 0x469d5d50 jclass=java/lang/reflect/Method jself=<jnius.jnius.LocalRef object at 0x469b7bc0>>, <Method at ... ]
[INFO ] TEST: Method.getName = accelerometerEnable
[INFO ] TEST: Method = ['__class__', '__cls_storage', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__javaclass__', '__metaclass__', '__module__', '__new__', '__pyx_vtable__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'getModifiers', 'getName', 'getParameterTypes', 'getReturnType', 'toString']
Thanks in advance,
Greetings
Nik