Android Vibration

Previous topic - Next topic

MK2004

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?

spacefractal

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.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MK2004

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





MrPlow

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



Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

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.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

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.

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Qedo

#6
Corrupted attachment  "SDLActivity.java" in this post
Ii is possible reload it?
Thank you

Qedo

is there anyone who can help me?

MrPlow

Hi

What do you need exactly?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Qedo

I wrote it on April 19th

MK2004

Hallo, here is it.

Qedo

Great, Thank you  :good: