Beta Betatester wanted: Telegram DatabaseLibrary (tdlib)

DonManfred

Expert
Licensed User
Longtime User
Hello, i am writing a wrap for the Telegram Database Library (tdlib).
It is based on native code (*.so) and are available for some abis (arm64-v8a, armeabi-v7a and x86 (the windowsemulator) .

Basically one should be able to create a Telegram Client in b4a using the tdlib and my wrapper.

At this time FAR NOT all Features are available. I am in the very first steps of all this.

But the connectionpart including Authentication is working. Getting all Updates is also available though not all upodatevariants are wrapped so far. This includes the Message, Users, Chat.

The new SDK is much complex. The Api consists on about 800 Different classes.
For now i do not know a way to do the steps easier. I just think to create wrappers for all of them...

I need help from users who are already working with Telegram..

The library will be able to authenticate a User (YOU) or authenticate as Bot. In Botmode there are more features available than in the Usermode. Mostly Usermode based objects/methods are wrapped as yet.


Known problems or other notes:
- The library is just a Feature to use the Api, get Objects, send Messages and so on. But there is NO UI Element. Must be created by ourself.
- As the messages in Telegram can be very complex getting the message in the updates is also komplex. a Message can contain so much "objects", mentions.

As the Library is big in size due to the multiple native libraries you need to Download it from my Dropbox. DOWNLOAD HERE.

For any issue you have: Please create a new thread in the questions forum.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Obtaining a SDK Key at Telegram to use the Library in your project.

Check here: https://core.telegram.org/api/obtaining_api_id

The interesting part is in
You will get basic addresses as well as the api_id and api_hash parameters required for user authorization.

These api_id and api_hash you need to configure in the example.

B4X:
    Dim params As TdlParameters
    params.Initialize
    params.ApiId = [api_key]
    params.ApiHash = [api_hash]
    params.DatabaseDirectory = Starter.rp.GetSafeDirDefaultExternal("TDLibSDK")
    params.FilesDirectory = Starter.rp.GetSafeDirDefaultExternal("TelegramFiles")
    params.useMessageDatabase = True
    params.useSecretChats = True
    params.systemLanguageCode = "de"
    params.deviceModel = "Desktop"
    params.systemVersion = "Unknown"
    params.applicationVersion = "1.0"
    params.enableStorageOptimizer = True
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This library does not work with B4J as there is no Windows dll which i could use. There are only native .so Files provided. One of them allows you to run it in an Android Emulator on windows.

But B4J will not work.

ETA: if you are familar with compiling C++ Sources into a DLL then you are welcome to create such a DLL for me. You can find the Sources on Github.
 
Last edited:
Upvote 0

kostefar

Active Member
Licensed User
Longtime User
Thanks DonManfred, I´d prefer to avoid the emulator for a bot running 24/7 since my genymotion crashes sometimes. There´s another bot api for b4j here that works but not perfectly and there´s no client library for b4j at all.
 
Last edited:
Upvote 0

kostefar

Active Member
Licensed User
Longtime User
I had a quick look at this project. I created an app_id and app_hash and added those into the example project. Also changed the phone number to the one used with my telegram account. These are the only things I changed.
But then when running it, I get:

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.Exception: Sub sdk_onresult signature does not match expected signature.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:188)
    at anywheresoftware.b4a.BA$2.run(BA.java:360)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
But then when running it, I get:
Please Create a NEW THREAD in the Questions forum. You should always create a new thread instead of oposting to an old thread.

Also post the signature you are using?

The Signature has changed.
B4X:
Sub SDK_onResult(tlo As Object, methodname As String)
 
Last edited:
Upvote 0

kostefar

Active Member
Licensed User
Longtime User
Please Create a NEW THREAD in the Questions forum. You should always create a new thread instead of oposting to an old thread.

Also post the signature you are using?

The Signature has changed.
B4X:
Sub SDK_onResult(tlo As Object, methodname As String)


Thanks, I just thought it would be easier for you to keep all questions regarding an ongoing development under one umbrella, but I´ve created a new thread here:

https://www.b4x.com/android/forum/threads/telegram-databaselibrary-tdlib-error-message.93530/
 
Upvote 0
Top