Giter Site home page Giter Site logo

trellixvulnteam / telegram-hms_tdt3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xymeng16/telegram-hms

0.0 0.0 0.0 78.27 MB

An Telegram client with Huawei Mobile Service Push Kit support

License: GNU General Public License v2.0

Shell 0.01% C++ 31.88% Python 0.18% Perl 1.82% C 25.03% Objective-C 0.05% Java 37.01% Go 1.51% Assembly 2.05% MATLAB 0.01% CSS 0.01% Objective-C++ 0.13% Makefile 0.01% CMake 0.21% Dockerfile 0.01% Roff 0.01% Starlark 0.01% Raku 0.01% NASL 0.11%

telegram-hms_tdt3's Introduction

Telegram Cilent for Android with Huawei Mobile Services Push Kit support

A customized Telegram client and relay server that can receive HMS Push Notification on Huawei Devices. This client allows Huawei users to receive Telegram messages without keeping the client alive at the background, eliminating the possible message missing incidence due to the battery policy of EMUI/HarmonyOS.

How to use

Client

  1. Obtain your own api_id for your application.
  2. Replace the corresponding information (APP_ID, APP_HASH, etc.) in TMessagesProj/src/main/java/org/telegram/hmsmsger/BuildVArs.java
  3. Replace the original package name org.telegram.hmsmsger with your customized one (This step is essential since the package name must be unique at next step)
  4. Register as a Huawei Developer, and create a new project then a new APP using your own package name in the AppConnect Console. Enable Push Kit and download the corresponding agconnect-service.json file to replace the dummy one under TMessagesProj/ directory. Make sure to add the given code inside the correct build.gradle files. For more detail of this step, please refer to the official tutorial of Huawei.
  5. Follow the official tutorial of Google Firebase to create APP and integrate Firebase into your APP. Remember to replace the dummy google-services.json under TMessagesProj/ directory with your own one and add the given code inside the correct build.gradle files.
  6. Use any approach you like to acquire the HMS PushToken of your Huawei Device. In this client I have implemented one possible approach in the ApplicationLoader.java file, named getToken(), FYR.
  7. Choose a proper build variant and then build the project and test it on your Huawei Device.

Relay Server (in telepy/ directory)

The relay server is written with Python, and some code are copied from hms-push-serverdemo-python. Its design rationale is receiving the incoming message via the MTProto API of Telegram then pushing the message to your Huawei Phone. Here I use Telethon to implement above operations.
In order to run the server, please follow these steps:

  1. Install Telethon and any required dependencies using your package management tools.
  2. Open telepy/tele.py replace [api_id, api_hash] (for Telegram) and [app_id, app_secret] (for HMS) with your own values. Make sure to run this program on a trusted server since the leakage of that information may incur the loss of your privacy and properties.
  3. Run the tele.py and log in with your Telegram account. Login is only required the first time you run the server program.
  4. Keep it running in the background via nohup/screen or any tools you like.
  5. Try if you can receive push notification on your Huawei Device! If not, you may check the output to see what happened.

telegram-hms_tdt3's People

Contributors

xymeng16 avatar trellixvulnteam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.