tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Java example - locked (message: Logging out) #2672

Closed culexjj closed 10 months ago

culexjj commented 11 months ago

Hello

After compiling TDLib & Java example I could made some simple tests (see my chats, send a message, etc) without any trouble but now every time I run the java example I get this output.

At the end you can see the message "Logging out"

TextEntities { entities = vector[6] { TextEntity { offset = 0 length = 9 type = TextEntityTypeMention { } } TextEntity { offset = 10 length = 13 type = TextEntityTypeBotCommand { } } TextEntity { offset = 24 length = 20 type = TextEntityTypeUrl { } } TextEntity { offset = 45 length = 11 type = TextEntityTypeUrl { } } TextEntity { offset = 57 length = 4 type = TextEntityTypeMention { } } TextEntity { offset = 62 length = 5 type = TextEntityTypeMention { } } } }

Logging out

I think it is related with this statement switch (Example.authorizationState.getConstructor()) where you can set the apiId & apiHash

I think I have to set the new value for id & hash I get here, is it right?

• Log in to your Telegram core: https://my.telegram.org/. • Go to "API development tools" and fill out the form.

Br

Culex

levlam commented 11 months ago

Try to update to the latest version from Github and check whether the issue is present there.

culexjj commented 11 months ago

Hi,

I have updated to the latest version and now I have this output

PS D:\TDLib2\td\example\java\bin> java '-Djava.library.path=.' org/drinkless/tdlib/example/Example Please enter phone number: here I write my country code + phone number Please enter authentication code: here I write the authentication send to my telegram app FATAL ERROR in native method: Can't find field [supportsSettings] with signature [Z] at org.drinkless.tdlib.Client.nativeClientReceive(Native Method) at org.drinkless.tdlib.Client$ResponseReceiver.run(Client.java:170) at java.lang.Thread.runWith(java.base@20.0.2/Thread.java:1636) at java.lang.Thread.run(java.base@20.0.2/Thread.java:1623) PS D:\TDLib2\td\example\java\bin>

What do you think?

Br

Culex

levlam commented 11 months ago

You updated TdApi.java, but libtdjni is still the old one.

culexjj commented 11 months ago

Hi,

You're absolutely right. It is working.

Enter command (gcs - GetChats, gc - GetChat, me - GetMe, sm - SendMessage, lo - LogOut, q - Quit): me User { id = 6xxxxxxx firstName = "Jxxxx"

I have also a question, for a beginner like me, apart from this url --> https://core.telegram.org/tdlib/getting-started and the Api Documentation, is there any site/forum you recommended for learning how to work with TDLIb?

Thank you very much

Culex

levlam commented 11 months ago

Information from https://core.telegram.org/tdlib/getting-started should be enough for basic usages. All classes and methods are fully documented in td_api.tl, and usually easily can be found there by keywords. There are no advanced usage guides, but if you have any question, you can create an issue on Github or ask in https://t.me/tdlibchat.

culexjj commented 11 months ago

Ok, thank you very much.