Full screen and device features
What it is
A Mini App can take the whole screen, in portrait or landscape, and use the phone itself: location, motion sensors, fingerprint or face. Smaller helpers include haptic feedback, a QR scanner and storage. Location and biometrics work only after the person allows them in Telegram's own window.
How to do it
- Full screen: add
&mode=fullscreento the link or callrequestFullscreen.lockOrientationkeeps the current orientation. - Location:
LocationManager.init, thengetLocation. If the person says no, you get nothing. - Motion: start
Accelerometer,DeviceOrientation(withneed_absolutefor compass data) orGyroscopewith arefresh_rate. - Biometrics:
BiometricManager.init, thenrequestAccessandauthenticate, each with a short reason. - Helpers:
HapticFeedback,showScanQrPopup, andCloudStorage,DeviceStorageorSecureStorageto remember things. - Check that the person's Telegram has the feature: full screen, location and motion need
isVersionAtLeast('8.0').
Watch out
- Full screen can fail with
UNSUPPORTED, and its header is transparent: keep buttons insidesafeAreaInsetandcontentSafeAreaInset. refresh_rateis 20 to 1000 ms (default 1000), and not every device keeps it.- A biometric reason is up to 128 characters.
- After a refusal,
openSettingscan lead the person to the settings, but only from a tap inside your app. - Storage per person:
CloudStorage1024 items of up to 4096 characters,DeviceStorage5 MB,SecureStorage10 items.
With Gem
Gem doesn't switch projects to full screen or use location, motion or biometrics today. Nearby: /newapp in @gembot builds a small Mini App from your description that runs in Gem's sandbox with its own link.
Sources
- https://core.telegram.org/bots/webapps#initializing-mini-apps
- https://core.telegram.org/api/links#direct-mini-app-links
- https://telegram.org/blog/fullscreen-miniapps-and-more