Simple OpenFL extension for accessing android native methods.
Currently implements methods to use the android vibrator and access screen dimensions.
Install via
haxelib git extension-nativefunctions https://github.com/manjav/haxe-extension-nativefunctions
Add to project.xml
:
<haxelib name="extension-natives" if="android" />
And import into your project (haxe) with:
import com.gerantech.extension.Natives;
Exposed methods are currently:
public static function vibrate(int duration):Void;
public static function wakeUp():Void;
More can be simply added in the java source file, replicating the function and
corresponding JNI.createStaticMethod(...)
call in Natives.hx
.
Thank you to alagator for contributing wakeUp()
and to ktravis for extension sample !