GLBasic forum

Main forum => GLBasic - en => Topic started by: MK2004 on 2019-Jan-10

Title: Android Vibration
Post by: MK2004 on 2019-Jan-10
Hallo,
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?
Title: Re: Android Vibration
Post by: spacefractal on 2019-Jan-10
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.
Title: Re: Android Vibration
Post by: MK2004 on 2019-Feb-07
Hallo,

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 "SDLActivity.java" 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) Select


?IFDEF ANDROID
        IMPORT "C" const char* android_JAVACALL(const char* string)
?ENDIF

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

SLEEP 2000


        FUNCTION CallJava$: Args$
                LOCAL result$
                ?IFDEF ANDROID
                result$=android_JAVACALL(Args$)
                RETURN result$
                ?ENDIF
        ENDFUNCTION




Title: Re: Android Vibration
Post by: MrPlow on 2019-Feb-07
Guys
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



Title: Re: Android Vibration
Post by: spacefractal on 2019-Feb-07
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.
Title: Re: Android Vibration
Post by: MrPlow on 2019-Feb-08
Is this what you mean...

Android SDK Tools Revision 24.0.2
Using latest Build Tools: 21.1.2
API level:        22

Im also on an older GLB but that is because I am using AE 2.9  (only for the reason to make sure my adverts still work - I am using Google services

<meta-data android:name="com.google.android.gms.version"
              android:value="7895000"/>

Only issues I have are background wakelocks related to audiomix - but loads of other frameworks have posts about the same issue - it only appeared since Android 8.0 came along...and its a problem for everyone including Unity - not sure if someone fixed it yet.

Title: Re: Android Vibration
Post by: Qedo on 2021-Apr-19
Corrupted attachment  "SDLActivity.java" in this post
Ii is possible reload it?
Thank you
Title: Re: Android Vibration
Post by: Qedo on 2021-Apr-23
is there anyone who can help me?
Title: Re: Android Vibration
Post by: MrPlow on 2021-Apr-25
Hi

What do you need exactly?
Title: Re: Android Vibration
Post by: Qedo on 2021-Apr-25
I wrote it on April 19th
Title: Re: Android Vibration
Post by: MK2004 on 2021-Jun-16
Hallo, here is it.
Title: Re: Android Vibration
Post by: Qedo on 2021-Jun-16
Great, Thank you  :good: