telegram-s / telegram

Telegram S Edition Android App
MIT License
224 stars 106 forks source link

"No network connection. Please try again." activation issue #60

Open longhillroad opened 10 years ago

longhillroad commented 10 years ago

Hi, thanks for your sharing this project. I downloaded and built the lasted master branch. However, after installing to a phone, I can not register. When trying to register a new phone number, it always complains "No network connection. Please try again.". My phone network connection on all other apps is just fine.

Any help?

Shyri commented 10 years ago

I'm having the same problem here. Did you manage to solve it?

longhillroad commented 10 years ago

No. not yet. Based on our two inputs, this could be a regression bug in the main branch. I tried to build other branches like 1.3, 1.2. However, I did not get those builds work, always complains about gradle version or 'default' not found. Did you try to build 1.3 or 1.2?

I registered my own API_ID and API_HASH from telegram app admin url. Replaced them in ApiConfig.java. No help at all. From telegram registration page, I also got a public key and server ip address for my app usage. However, I did not find right places to put those 2 values. I did a search and found the existing main code is using the same IP address already.

The issue is MTProto authSendCode() method never gets a return based on my rough debug log filtering. Can you do some debugging and share what you find?

Shyri commented 10 years ago

I've tried to build branches 1.3 and 1.2 but those seem to use an older version of mtproto library which does not contain some classes or something. I've tried with dev branch which needs also some changes in order to work with last mtproto and tlcore libs (mainly TLByte class which seems that it wasn't present in some older versions), it builds but ends up with the same problem. Everything I do is a little bit messy because I'm using eclipse and I have to do some changes in order to import it as a project (feeling a bit lazy to move to Android Studio and get used to it yet :P)

So far what I can tell reading the logs is that at some point it throws these exceptions during the app boot:

java.lang.SecurityException at org.telegram.mtproto.transport.TransportPool.decrypt(TransportPool.java:148) at org.telegram.mtproto.transport.TransportTcpPool$TcpListener.onRawMessage(TransportTcpPool.java:322) at org.telegram.mtproto.transport.TcpContext.onMessage(TcpContext.java:167) at org.telegram.mtproto.transport.TcpContext.access$15(TcpContext.java:162) at org.telegram.mtproto.transport.TcpContext$ReaderThread.run(TcpContext.java:320) Breaking context

And:

Sync failure: sendLog java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at org.telegram.android.core.background.sync.BaseSync.performSync(BaseSync.java:180) at org.telegram.android.core.background.sync.BaseSync$SyncHandler.handleMessage(BaseSync.java:265) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176) at android.os.HandlerThread.run(HandlerThread.java:61) Caused by: org.telegram.api.engine.TimeoutException at org.telegram.api.engine.TelegramApi.doRpcCall(TelegramApi.java:369) at org.telegram.api.engine.TelegramApi.doRpcCallNonAuth(TelegramApi.java:428) at org.telegram.api.engine.TelegramApi.doRpcCallNonAuth(TelegramApi.java:420) at org.telegram.android.core.background.sync.BackgroundSync.sendLog(BackgroundSync.java:337) ... 7 more

An then at some point it logs this message which makes me think that indeed there must be something wrong with mtproto:

Auth key invalidated: AUTH_KEY_UNREGISTERED.

longhillroad commented 10 years ago

I stuck on a similar error message like "W/T|MT|MTProto#1001﹕ Auth key invalidated" (I did not see the AUTH_KEY_UNREGISTERED string though. Maybe I missed it)

Maybe we have to understand how MTProto works to make it work. Since we have the source code of the MTProto, in theory, is it enough for us to fix the problem if ex3ndr is too busy with other things?

Shyri commented 10 years ago

I think it is the same error, in my case at the first tries I had the same error message as yours "W/T|MT|MTProto#1001﹕ Auth key invalidated". The I pulled the last commit of mtproto library (from 10 days ago). As you can see: https://github.com/ex3ndr/telegram-mt/commit/4a1e6fd6e87401eddbf3258c0fd01c13994c5ac2 at line 342 of MTProto.java he included the errorTag in the log so maybe thats why.

After trying all branches again. I downloaded the relese source code (https://github.com/ex3ndr/telegram/releases) and rolledback mtproto to version commited on Mar 14, 2014 with no luck.

I'm gonna study mtproto lib and seek if there is an error actually. According to Telegram API Docs (https://core.telegram.org/api/errors) AUTH_KEY_UNREGISTERED means "The key is not registered in the system". If I cannot find something in several hours maybe I try rolling back versions of mtproto in conjuntion with master, dev and release versions till I find some combination that works. Will post everything i find out later

longhillroad commented 10 years ago

Shyri, sounds good. I know one engineer who is trying to learn Android will dig more on this in the following days. Will see.