Wake Lock screen permission for Android mobile devices

For the build:

  1. Install node Js
  2. Open the command line and type npm i --global cordova
  3. Change the directory if the command line to your GDevelop installation directory (changing directory in command line is with cd, Google that if you don’t know how to use it)
  4. Change directory to resources\GDJS\Runtime\Cordova
  5. Enter the command cordova plugin add [https://github.com/Viras-/cordova-plugin-powermanagement.git](https://github.com/Viras-/cordova-plugin-powermanagement.git) in the command line
  6. Build normally from GDevelop.

hi and thank you very much

but how should it be different, it doesn´t work, here my steps:

i´ve downloaded node.js = check

i opened the cmd and and typed npm i --global cordova.
so far so good, this is what i get:

now i´ve changed the directory as you described:
erkl2
erkl3

correct way?

now one can see new elements in the directory:

now i´ve tried to pack an app vie GDevelop as usual, but now i get an error
:

in the log file are only “ERROR” nothing more
i´ve tried again without the java code in my app, same result:

With the code:

and without:

:man_shrugging:

What did i wrong?

meanwhile i did it (partly at least) with your first description.

This “cd” thing in cmd was the key, i didn´t understand what has been the meaning of “Go with cmd to exported directory” now i got it.

And i´ve uploaded the for cordova exported files to phonegap and i was able to download my app.
But the app doesn´t work, it freez, maybe i did something wrong in your description “Create a JS event that will be called a single time”?

I am not sure what you did wrong, everything seem right. Sorry, I can’t help you further.

Ok thank you, i’ll keep on trying🤙

Viel Glück! :slightly_smiling_face:

Hello. If the app freezes during the loading (at 100%) check if it’s because of the JS script you’ve added (remove it and check if the app exports correctly and works). For me my app worked perfectly as long as there was no JS script in the events. If that’s the case then you may want to export the game manually once again and then in cmd do this (after you have installed the gihub addon - git smc: Git - Downloads):

  1. Go to the exported directory of the exported project with cmd.
  2. Then type: cordova plugin add https://github.com/Viras-/cordova-plugin-powermanagement.git
  3. Wait until the plugin gets added to the directory and your project
  4. After that in the same window type: cordova platform add android
  5. Wait until it gets finished and then type: cordova build android
  6. After that go to the directory shown in the cmd window (there should be a prompt that cordova successfully build android apk and saved it in a {} directory) everything should work

Hopefully that helps :slight_smile: .

PS: you may want to type: “npm i -g cordova” to update it to the newest version.
Plus check what type of Java you have installed on your PC, If it’s JDK 1.8. (not JRE) then you’re good. If it’s JDK 9, 10, 14 or something new then for some reason it won’t work.
Plus make sure you have Android Studio IDE installed (preferably build 173, it automatically installs Android SDK and Gradles which are required to build android via cordova)

1 Like

Danke Danke :grin:

i didn´t get it till now, i worked with clickteam again because for this app i need a WakeLock

1 Like

Hi :raised_hand_with_fingers_splayed:

yea wonderful, i´ll try it as soon as possible, i let you know about my results

Tahnk you very much :hugs:

YEAAHHHH IT WORKS!

Thank you very muyh Darious and Arthuro555 :star_struck:

Of course i had exactly that problem you descriped (Problems with JDK a.s.o.)
After many installations, De-installations, Re-installations, i´ve found out that i hav to set the enviroment for JDK and Gradle.
I had several JDK Versions, so i deleted all of them but JDK 8. (1.8_XXX)
further i´ve found good sites where you get good explainments how to set the enviroment:

For Gradle i found this
Video

and for setting the JDK envirmonet:

(sorry, only in german)

But after fixing that, it worked as you descriped - thank you very much again :+1:

nevertheless, i hope there will be easier ways to handle such things in future :blush:

1 Like

I’m glad it worked :slight_smile:. Now you’re one step further towards the release. Once you get a hang on the manual export and then cmd you can open the exported project files in Android studio and, for example, change the color of your Splashscreen background (pretty simple to do) and more (pretty hard to do :wink:).

well i have another issue… :tired_face:

I´ve tried to upload my apk, but Google Play prompt me an error because of debugable App.
I have to set debuggable to “false”.
I´ve try to change in android studio, but the file is readable only.
Where do i change this?

regards
Mario Michel

  • AndroidManifest.xml should be editable
  • AndroidManifest.xml should NOT contain the debuggable attribute
  • Remember to build with release flag (example: cordova build --release android)

OOOKKKK… it dosen´t work
When i upload the Akp with “cordova build --release android” instead of “cordova build android” Google Play prompt me an other problem: invalid signature ERROR: JAR_SIG_NO_SIGNATURES: No JAR signatures - the first problem is gone, another takes place :man_facepalming:

Yes, you need to sign your apk. There are billions of tutorials for that on internet. This is all basic Cordova problems, you could solve them by just googling instead of asking here and waiting for an answer.

arthuro, you can be sure, before i post any questions here in that forum (a forum should be there fore help) i try to find it out by my own via google in the first place.
It´s hard to explain “google” my problem in relation with Gdevelop 5. It seems the most answers are in relation to android studio and codes you are written there, you know what i mean?
I tried to sign my app, but it seems android studio can´t handle Gdevelop export apps.
I tried to sign my app via cmd, and in the very moment when i´m to the line where i have to type my settings, i can´t type anything (keyboard without any reaction).
I watched feeled 1000 of videos about that issue, but non of them is really helpful, either the settings are different, or i can´t do what the people in the videos do becaus of “only read…” things a.s.o.

If you don´t like to answer, don´t do it, it´s fine, but let me my freedom to ask what ever i want…

Whoa, I am sorry you took it like this! I didn’t meant it like this question is a bad one or anything, just that there probably is a solution already on google and it might be quicker for you to look up there instead of having to wait for me or someone else to come online and respond to you, and you could get maybe faster help on Cordova specialized forums :wink:. For signing, (assuming you have the jdk and android sdk in your path and already compiled the APK in release mode) you need first to create a keystore, using the jdk tool keytool: keytool -genkey -v -keystore my.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias app. Then you need to optimize the APK for Google play before signing it. To do that use zipalign from the sdk: zipalign -p 4 my.apk my-optimized.apk. Finally proceed to signing with apksigner from the android sdk build tools: apksigner sign --ks my.keystore my-app.apk --ks-key-alias alias_name.

sorry, it seems i really get it wrong :see_no_evil:

thank you for your help i´ll try my best :+1:

Hey. If you still didn’t generate signed apk the easiest way to do this is to:

  1. Do the export like I wrote earlier (INCLUDING “cordova build android” because it adds gradle and android SDK to your project at the same time as it builds .apk).
  2. Then open your project in android studio (you have to go to your exported directory and then into “platforms” → select “android” folder and click open)
  3. Last but not least. In the toolbar at the top of the screen find “Build” menu → “Generate signed apk”
  4. When you’re doing it for the first time you have to click “Create new” button and follow the instructions: Sign your app  |  Android Developers (one BIG advice, write ALL the information from this window somewhere where you can find it, so in the future you will have the keys to update your app on Google Play)

EDIT: In the next menu from the “Generate signed apk” window choose both “Signature Versions” and “Build type” as “Release”

hi all

sorry for delayed answer, i ´ve been really busy …

well, i´ve have some issues with android studio, must be a setting thing.
i´ll take care about as soon as possible. But meanwhile i´ve made it with clickteam fusion, there is a great and easy keytool generator, better than everything i have seen…

now my app is in pending for release. i guess i will flip from clickteam and Gdevelop depanding in what functions i need.

But of course i will save this conversation, it helped me up in many ways, thank you therfore guys :vulcan_salute:

1 Like