Dmesg command for android, get trusted date


How do I get the log of the phone (more specifically date) simular to dmesg on Linux in Defold on Android without root permissions?

I know that Android is based on Linux, but how do you get the log on the phone?

(The problem is related to offline games using daly rewards, you can just skip one day and because the phone only reads the active time (socket.gettime()) it thinks that you waited one day. Is there a solution in Defold for this problem, like to read the log of the phone)


You can use an online server based timestamp like what DefQuest uses. It forces users to have an Internet connection, but you can still let them play otherwise just put the daily refresh stuff behind an online sync gate and don’t give new daily rewards until an Internet connection is detected again.


I know that something like that is easy to set up, but I want a system that can work without an internet connection at all :confused:


Not sure if it’s what you are after, but it sounds like the push notifications might be useful to you?

There you set an “alarm” (e.g. 24h) for a reward, and it will show a badge on the phone, which the user can click on to launch the game again. If you’ve then set a listener, you will get this info when you start the game.

Currently, we’re fixing an issue with the Android implementation, that the local notifications doesn’t persist between sessions. This should be fixed in the 1.2.129 release.


I just want a trusted time that can’t be changed by the user. A way to do that is to take the time of the users phone built in log and get the timestamp, checking if the user have changed the time.


You need a native extension for that. And on Android I’m guessing you also need to ask for additional permissions. (which may scare away your players). My questions is if cheating is really that big of a problem? You will always have a small group of players trying to cheat their way to success, but the majority can’t be bothered to be honest.


Got it, thanks