How Lua Engines work with Android

#1

Game Engine Cores are a dynamic on their own. And I God willing plan to cover these topics in more details in coming articles. But for now, ever wondered how Lua Game Engines interface with Android? Well…

Examining how Lua Game Engines work on Android

This article is inspired by my recent experiment on Defold Foundation’s Defold Engine with the extension I had developed for Android to get battery charge percentage and charging status.

6 Likes

#2

Cool. I created two issues in the repo: 1) Typo in function name 2) Question about the AndroidManifest

1 Like

#3

Nice catch… I will solve the typo. Can you advise me more about how AndroidManifest.xml is actually handled for Manifests that may need to have additional add on permissions, etc? I would love some advise…

0 Likes

#4

We support manifest stub files. These are partial manifest files with the required additions needed for your extension. They get merged using the Android manifest merge tool when building.

Example: https://github.com/defold/extension-camera/blob/master/camera/manifests/android/AndroidManifest.xml

Docs: https://defold.com/manuals/extensions/#manifest-files

1 Like

#5

Nice!
Don’t forget to add the library to the Asset Page, so others can find it more easily (I couldn’t find it there at least):

2 Likes

#6

Thanks for this. Let me see how to act on this then

0 Likes

#7

Thanks for the reference. Let me see how I can try submit it to the asset store in a format that works.

0 Likes

#8

Submitted

1 Like

#9

I’m reading this documentation https://developer.android.com/training/monitoring-device-state/battery-monitoring and not sure why you need android.permission.READ_PHONE_STATE there?
This is one of dangerous permissions, so the general recommendation for android developers is to reduce the number of such permissions as much as possible in an application if it’s possible of course.

2 Likes

#10

I can check to see that. I think I read somewhere it may be required but maybe it may be required, but maybe I may be misinformed. Let me try remove it and see if it functions without that permission.

0 Likes

#11

Actually you were right… It seems that permission was not necessary. I have removed it, let me create a new release for it with the fix.

3 Likes

#12

@AGulev @britzl @Mathias_Westerdahl thanks guys… Just got the extension on the Asset Store: https://defold.com/assets/batterystatus/

2 Likes