Page 1 of 1

Vibrations on Android

Posted: Mon Jan 02, 2023 12:13 pm
by Ats
Hello. Today, I'm trying to use the code I wrote for shaking the XInput controller to also shake the Android booty.
I added the permissions in the AndroidManifest.xml but I have no clues of how to access Android functions such as VIBRATOR_MANAGER_SERVICE from ZGE.

I guess I have to use ZExternalLibrary?
Maybe adding public abstract Object getSystemService (String name) to the ZExternalLibrary.Source

But what would be the ModuleName?

Re: Vibrations on Android

Posted: Mon Jan 02, 2023 1:48 pm
by VilleK
The problem with Android libraries is that they are in Java and it is complicated to call Java methods from native code. You can look at this page: https://stackoverflow.com/questions/519 ... in-android

Re: Vibrations on Android

Posted: Mon Jan 02, 2023 4:51 pm
by Ats
Ok. So I would need to create a library just for shaking the Android, like rado1 did for tilting the sensors?
https://github.com/Rado-1/ZgeSensor

Re: Vibrations on Android

Posted: Tue Jan 03, 2023 8:42 am
by VilleK
Ats wrote: Mon Jan 02, 2023 4:51 pm Ok. So I would need to create a library just for shaking the Android, like rado1 did for tilting the sensors?
https://github.com/Rado-1/ZgeSensor
Yes I think that is the best way forward if you decide to do this.