Here is an answer from ChatGPT
Taifun
Good question — this is a very common issue for apps that rely on daily rewards or time-based logic.
Let’s break it down for Kodular / App Inventor environments (which run as standard Android apps).
1. Detect if “Automatic date & time” is OFF
Unfortunately, App Inventor / Kodular does not have a built-in block to check whether the system’s “Automatic date & time” (network-provided time) is enabled.
However, this information can be read on Android using the following Java APIs:
Settings.Global.getInt(getContentResolver(), Settings.Global.AUTO_TIME, 0)
- Returns
1 → Automatic date & time ON
- Returns
0 → Automatic date & time OFF
But — you can’t call that directly from App Inventor unless you use an extension.
2. Using an Extension
To access that Android setting, you’d need a custom extension (AIX) that calls this Java API.
Option A: Use an existing extension (if available)
There is no official extension that exposes this setting yet, but some community extensions can read global settings.
Try searching for:
- “Device Settings Extension”
- “System Settings Extension”
- “Get System Property Extension”
For example, developers like Atom Developer or Sunny Gupta (Sunny) often publish such tools.
If none exists, you can create one easily with a short Java snippet:
@SimpleFunction
public boolean IsAutomaticTimeEnabled() {
try {
return Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME) == 1;
} catch (Settings.SettingNotFoundException e) {
return false;
}
}
3. Open the Settings screen
You can open the date/time settings screen using an Activity Starter:
| Property |
Value |
| Action |
android.settings.DATE_SETTINGS |
That will open the Android date & time settings screen where the user can turn Automatic date & time back ON.
4. Workaround if you can’t check AUTO_TIME
If you cannot or don’t want to use an extension, there are still some practical checks you can do:
- Compare device time with an internet server time (e.g., via a small API call like
https://worldtimeapi.org/api/ip).
→ If the difference is large (say >2 minutes), assume the user changed time manually.
This method works entirely in App Inventor, using the Web component.
Summary
| Goal |
How to do it |
| Detect if automatic time is off |
Needs small custom extension (uses Settings.Global.AUTO_TIME) |
| Open date & time settings |
Use Activity Starter → android.settings.DATE_SETTINGS |
| Detect time cheating without extension |
Compare device time to online time API |
If you’d like, I can provide the Java source code and full AIX extension template for IsAutomaticTimeEnabled() — would you like me to generate that?
package com.yourname.autotimedetector;
import android.provider.Settings;
import android.content.Context;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.runtime.*;
@DesignerComponent(
version = 1,
description = "Detects if Automatic Date & Time is enabled on the device.",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "aiwebres/icon.png"
)
@SimpleObject(external = true)
public class AutoTimeDetector extends AndroidNonvisibleComponent {
private Context context;
public AutoTimeDetector(ComponentContainer container) {
super(container.$form());
context = container.$context();
}
@SimpleFunction(description = "Returns true if 'Automatic Date & Time' is enabled in system settings.")
public boolean IsAutomaticTimeEnabled() {
try {
int autoTime = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME);
return autoTime == 1;
} catch (Settings.SettingNotFoundException e) {
return false;
}
}
@SimpleFunction(description = "Returns true if 'Automatic Time Zone' is enabled in system settings.")
public boolean IsAutomaticTimeZoneEnabled() {
try {
int autoZone = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE);
return autoZone == 1;
} catch (Settings.SettingNotFoundException e) {
return false;
}
}
}