Mobile: Can Obsidian API provide current geo location (GPS) on Android/iOS?

It would be great to get accurate GPS location, but this is what I’m doing on mobile for general location using Templater. It requires an internet connection, and will insert a placeholder (or blank) if none is available.

Works great on desktop or mobile. Templater script:

<%*
return Promise.race([
    new Promise((resolve) => {
        fetch('http://ip-api.com/json/')
            .then(response => response.json())
            .then(data => resolve([data.city, data.regionName, data.country].filter(x => !!x).join(', ')))
    }),
    new Promise((resolve) =>
        // If we haven't fetched the location within 300ms,
        // time-out and resolve with the placeholder text instead
        setTimeout(() => resolve('Location'), 300)
    )
])
%>
4 Likes