Main forum > GLBasic - en

Android Vibration

(1/3) > >>

I want use Vibration in my Android Game, is it possible to use the Vibration with JAVACall?
If this is possibel how should i do this?

not official, just to been noted, you can currectly not release your game on Google Play, but you can release it on other stores. Im do cant remember on my head, because im is soon vaccation.

But all javacalls is been called to SDLActivity.Java, and if you have expirence with java, you can add it and remember to eventuelly add the permission in manifest as well.


I solved the Problem.

First edit the file "AndroidManifest.xml" in the directory
C:\Program Files (x86)\GLBasic\Compiler\platform\android\templateproj\
put in this to activate Vibration permission.
<uses-permission android:name="android.permission.VIBRATE"/>

I used Notepad++

Secondly edit the file "" in the directory
C:\Program Files (x86)\GLBasic\Compiler\platform\android\templateproj\src\com\glbasic\test\

I attach my file

Third my GLBasic Code

--- Code: (glbasic) ---
        IMPORT "C" const char* android_JAVACALL(const char* string)

// The mobile phone vibrates for 1000 milliseclaps
LOCAL v=CallJava$("vibriere:1000")

SLEEP 2000

        FUNCTION CallJava$: Args$
                LOCAL result$
                ?IFDEF ANDROID
                RETURN result$

--- End code ---

Just so you know I did recent update to game-killing bug I had to fix
I just updated the manifest to target api version "26" and uploaded the new version it worked fine - no increased crashes or anything.

I still have pre-api issue with the stuck background wake locks - which is high - and liinked to Audiomix
I am investigating trying to fix with a change I did SDLActivity.

So Google is still working for now using current compiler but using target of the higher api

this is nice to hear its still possible, even using the older SDK but with new API. Which kind of pre-api do you have?

Im should checking thing like that, so this is a workaround for now, until the next year 64bit requirements.


[0] Message Index

[#] Next page

Go to full version