Telegram is a messaging app with a focus on speed and security. It’s superfast, simple and free.
This is an unofficial fork of Telegram App for Android, maintained by rebasing Mercurygram patches and forward-ported de-googling patches on top of upstream Telegram.
- Add ID in Profile Info
- Add a menu in Notifications and Sounds in order to set the UnifiedPush distributor. The same menu may be long-clicked to inspect recent UnifiedPush notification/decryption stats
- Add a menu in Notifications and Sounds in order to set the UnifiedPush WebPush gateway
- Add toggle setting in Chat Settings to start video messages with rear-facing camera
- Add toggle setting in Chat Settings to hide keyboard on chat scroll
- Add toggle setting in Chat Setting to hide "All Chats" tab (feature from NekoX)
- Add administrators item in group/channel info
- Add toggle setting in Debug Menu to enable Message Details menu
- Add toggle setting in Debug Menu to disable Unified Push support
- Add toggle setting in Debug Menu to disable Secure Flags. This option must only be used for debugging
- Add toggle setting in Debug Menu to remove sponsored messages and proxy sponsor banners. This option must only be used for debugging
- Re-add Monet themes (#31)
- Disabled DOH resolving since this leaks your used proxy to Google and it's not needed since Android DNS over TLS should be used instead
- Unlock premium app icons for anybody
- Unlock 5 accounts (was 3) and remove premium check for number of accounts
- Add toggle setting in Chat Settings to send large photos (2560px instead of 1280px)
- Telegram application icons are replaced with hermes wing (Created by Anthony Ledoux from Noun Project)
These patches were originally derived from the Telegram-FOSS effort, but Mercurygram now forward-ports and rebases them directly onto upstream Telegram.
Replacement of non-FOSS, untrustworthy or suspicious binaries or source code:
- Do location sharing with OpenStreetMap via MapLibre instead of Google Maps
- Use Noto emoji set instead of Apple's emoji
- Google/Firebase push services replaced with UnifiedPush
- SECURITY: BoringSSL, FFmpeg, libvpx, dav1d, and tde2e are built from source at compile time instead of shipping upstream prebuilts
Removal or stubbing of non-FOSS, untrustworthy or suspicious binaries or source code and their functionality:
- Google Play Services / Firebase dependencies from the default Mercurygram build and manifests
- Google Maps / Fused Location providers are stubbed out and replaced by MapLibre / Android location providers
- Google Wallet, SafetyNet, Play Integrity, and related proprietary verification pieces are stubbed out through local compatibility classes
- Google Cast integration
- Google ML Kit / Google Vision integrations, including barcode and face detection paths
- Android passkey support is disabled as Telegram servers verify the APK signature, which fails for unofficial forks
Other:
- Added the ability to parse locations from intents containing a
geo:<lat>,<lon>,<zoom>string - Force static map previews from Telegram
- No content restrictions
In order to have reliable notifications, it may be necessary to set battery optimization to Not optimized for Mercurygram (no, it won't use more battery).
Background Connections setting is not necessary and uses lot of battery, so please disable it when you use UnifiedPush.
If you set Battery optimization to Not optimized, Keep-Alive Service will be not necessary.
See dontkillmyapp for more information.
If you can't/want set Battery optimization to Not optimized and you don't receive notifications after a while (more than 30 minutes) please enable Keep-Alive Service instead.
Mercurygram uses Telegram's WebPush notifications through UnifiedPush.
When the app registers with a UnifiedPush distributor, it generates its own WebPush keypair and auth secret, then sends Telegram a WebPush token in JSON form:
{"endpoint":"https://<gateway>/aesgcm?e=<distributor-endpoint>","keys":{"p256dh":"...","auth":"..."}}Telegram encrypts notifications with WebPush aesgcm (Draft 4) and sends them to the configured gateway. The gateway forwards them to the chosen UnifiedPush distributor while embedding the Encryption and Crypto-Key headers into the request body, because UnifiedPush distributors do not preserve arbitrary HTTP headers.
Mercurygram then decrypts the payload locally and passes the MTProto notification payload to Telegram's normal notification pipeline. If decryption fails, it falls back to a wake-up notification path.
The gateway is configurable from Notifications and Sounds. Mercurygram currently defaults to https://p2p.belloworld.it/.
Note:
ntfy.sh(the public hosted instance) does not work through the default Mercurygram gateway athttps://p2p.belloworld.it/. That gateway is hosted on OCI infrastructure, and its IP is repeatedly blocked byntfy.shdue to connection volume. The production nginx in front of the gateway short-circuitsntfy.shendpoints with an immediate 201 response instead of proxying them. If you want to usentfy, prefer a self-hosted instance.
Two self-hostable gateway implementations are included in this repository:
The public Rust instance only accepts Telegram server IP ranges (https://core.telegram.org/resources/cidr.txt) to reduce abuse.
For a couple of reasons:
- Mercury is the Roman, and I'm Italian, God and the "messenger of the gods"
- The logo is a stylized 'F' representing his winged shoes, but it also resembles an 'F' in honor of Freddy Mercury.
- drizzt
- you? :)
- thermatk
- you? :)
- slp
- Bubu
- Sudokamikaze
- l2dy
- maximgrafin
- vn971
- theel0ja
- AnXh3L0
- noplanman
- vk496
- verdulo
- anupritaisno1
- nekohasekai
- kdrag0n
- terachad
- ppnplus
- luvletter2333
- 23rd
- proletarius101
- CWJamieson
- verdulo
- tehcneko
This repository contains tags to make tracking versions easier.
Versions are in form "$UPSTREAM.$RELEASE" where:
- $UPSTREAM is the upstream Telegram version.
- $RELEASE is a number ([0-9]*), indicating minor releases between official upstream versions.
Telegram API manuals: https://core.telegram.org/api
MTproto protocol manuals: https://core.telegram.org/mtproto
NOTE: Building on Windows is, unfortunately, not supported.
Consider using a Linux VM or dual booting.

Prerequisites: Android SDK with NDK 21.4.7075529, JDK 17, and Ninja.
Clone the repository (submodules are initialized automatically at build time):
git clone https://github.com/Mercurygram/Mercurygram.git
Build with Android Studio or from the command line:
# Fat APK (all ABIs)
./gradlew assembleAfatRelease
# Single-ABI APKs (F-Droid)
./gradlew assembleAfatFdArm32Release # armeabi-v7a
./gradlew assembleAfatFdArm64Release # arm64-v8a
./gradlew assembleAfatFdX86Release # x86
./gradlew assembleAfatFdX86_64Release # x86_64Native libraries (FFmpeg, BoringSSL, libvpx, dav1d, tde2e) are built from source automatically on the first build and cached for subsequent runs.
If you want to publish a modified version of Telegram:
- You should get your own API key here: https://core.telegram.org/api/obtaining_api_id and create a file called
API_KEYSin the source root directory. The contents should look like this:APP_ID = 12345 APP_HASH = aaaaaaaabbbbbbccccccfffffff001122 - Do not use the name Telegram and the standard logo (white paper plane in a blue circle) for your app — or make sure your users understand that it is unofficial
- Take good care of your users' data and privacy
- Please remember to publish your code too in order to comply with the licenses
