Acquiring GPS Position...
Please wait while the system checks your distance to the pinpoint location.
Allow browser location access if prompted.Live Camera
Click "Start Live Camera" to view your live camera, or tap "Open Native Camera" to snap using your phone's camera app.
Set the exact pinpoint coordinates for your office, classroom, or venue. Users can only take attendance when physically inside the specified radius.
Allows you to test both Inside Geofence and Outside Geofence states directly from your computer without walking outside!
To prevent proxy attendance, each device is locked to one registered staff member.
Connect your app to Cloudflare Pages. Whenever you update code on your PC and deploy, every phone automatically receives the update instantly without reinstalling the APK!
https://geoattend-1ll.pages.dev. If offline, the app seamlessly uses local phone assets.
-
Create a new Google SheetGo to sheets.new and name it Attendance Register.
-
Open the Apps Script EditorIn your Google Sheet menu bar, click Extensions โ Apps Script.
-
Paste the Script CodeDelete any default code in
Code.gsand paste the code below:
function doGet(e) {
if (e && e.parameter && (e.parameter.name || e.parameter.userId || e.parameter.action === 'record_attendance' || e.parameter.action === 'test_connection')) {
return handleRecord(e.parameter);
}
return ContentService.createTextOutput(JSON.stringify({
status: "active",
app: "GeoAttend Attendance Endpoint",
message: "Google Apps Script endpoint is online and ready to receive attendance records."
})).setMimeType(ContentService.MimeType.JSON);
}
function doPost(e) {
var data = {};
if (e && e.postData && e.postData.contents) {
try {
data = JSON.parse(e.postData.contents);
} catch (err) {
data = e.parameter || {};
}
} else if (e && e.parameter) {
data = e.parameter;
}
return handleRecord(data);
}
function handleRecord(data) {
try {
var ss = SpreadsheetApp.getActiveSpreadsheet();
if (!ss) {
throw new Error("Active spreadsheet not found. Ensure this script is created via Extensions -> Apps Script inside your Google Sheet.");
}
var sheet = ss.getActiveSheet();
// Deduplicate rapid transmissions (within 30 seconds)
var cache = CacheService.getScriptCache();
var recordId = data.id || (data.userId + "_" + (data.timestamp || ""));
if (recordId && cache.get(recordId)) {
return ContentService.createTextOutput(JSON.stringify({
result: "success",
message: "Duplicate entry safely debounced."
})).setMimeType(ContentService.MimeType.JSON);
}
if (recordId) {
cache.put(recordId, "logged", 30);
}
// Initialize header row on first submission
if (sheet.getLastRow() === 0) {
sheet.appendRow([
"Timestamp",
"Full Name",
"User ID",
"Department",
"Action Type",
"Distance (m)",
"Allowed Radius (m)",
"Status",
"Latitude",
"Longitude",
"GPS Accuracy (m)",
"Remarks",
"Device Info"
]);
var headerRange = sheet.getRange(1, 1, 1, 13);
headerRange.setFontWeight("bold");
headerRange.setBackground("#1E3A8A"); // Navy blue
headerRange.setFontColor("#FFFFFF");
headerRange.setHorizontalAlignment("center");
sheet.setFrozenRows(1);
for (var col = 1; col <= 13; col++) {
sheet.autoResizeColumn(col);
}
}
var formattedTime = data.timestamp || Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "yyyy-MM-dd HH:mm:ss");
sheet.appendRow([
formattedTime,
data.name || "",
data.userId || "",
data.department || "General",
data.actionType || "Check In",
data.distance !== undefined ? data.distance : "",
data.allowedRadius || "",
data.status || "VERIFIED",
data.latitude || "",
data.longitude || "",
data.accuracy || "",
data.notes || "",
data.userAgent || ""
]);
var newRow = sheet.getLastRow();
sheet.getRange(newRow, 1, 1, 13).setVerticalAlignment("middle");
return ContentService.createTextOutput(JSON.stringify({
result: "success",
row: newRow,
message: "Attendance recorded successfully"
})).setMimeType(ContentService.MimeType.JSON);
} catch (err) {
return ContentService.createTextOutput(JSON.stringify({
result: "error",
message: err.toString()
})).setMimeType(ContentService.MimeType.JSON);
}
}
-
Deploy as Web AppClick Deploy โ New Deployment.
Click the gear icon โ๏ธ โ Select Web app.
Set Execute as: "Me".
Set Who has access: "Anyone" (crucial so submissions work without login prompts).
Click Deploy, grant permissions, and copy the Web App URL into the box above!
| Timestamp | Name | ID / Roll | Department | Action | Distance | Cloud Sync |
|---|
To mark attendance from any smartphone (Android or iPhone), connect your phone to the same Wi-Fi network and scan the QR code below:
When you open the link in Chrome, Edge, or Samsung Internet on Android:
- Tap the "๐ฒ Install Mobile App" button at the top header, or tap browser menu (โฎ) โ "Install app" / "Add to Home Screen".
- Android automatically creates and installs an official native WebAPK on your phone with the GeoAttend app icon.
- The app opens full-screen (without browser bars), works completely offline, and retains full GPS & camera permissions!
We have included a complete Android WebView project in the android-project/ folder:
- Open the
android-projectfolder in Android Studio. - Click Build โ Build Bundle(s) / APK(s) โ Build APK(s).
- Android Studio will generate your standalone
app-debug.apkready to install on any Android phone!
You can also use Microsoft's official free tool PWABuilder.com: enter your URL or upload the project to generate a signed Android APK in under 1 minute!