Vibrations on Android

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
Ats
Posts: 762
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Vibrations on Android

Post 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?
User avatar
VilleK
Site Admin
Posts: 2355
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Vibrations on Android

Post 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
User avatar
Ats
Posts: 762
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Vibrations on Android

Post 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
User avatar
VilleK
Site Admin
Posts: 2355
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Vibrations on Android

Post 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.
Post Reply