telegram-s / telegram-api-old

Telegram Api library for java
MIT License
138 stars 64 forks source link

Any chance we could get a quick start? #4

Closed SireInsectus closed 10 years ago

SireInsectus commented 10 years ago

There is tons of documentation, and I appreciate that, but it is a bit overwhelming. Any chance you could help with a quick start that would get us to the point of sending a simple message? Here is what I have so far...

public class Test {

  public static void main(String...args) {
    try {
      new Test().run();
    } catch (Exception e) {
      e.printStackTrace();
    }
    System.exit(0);
  }

  public Test() {
  }

  public void run() throws Exception {

    CpAppInfo appInfo = new CpAppInfo(
      0,                // appId
      "deviceModel",    // device model
      "systemVersion",  // systemv ersion
      "appVersion",     // app version
      "langCode"        // language code.
    );

    TelegramApi api = new TelegramApi(new CpApiState(), appInfo, new ApiCallback() {
      @Override
      public void onApiDies(TelegramApi api) {
        // When auth key or user authorization dies
      }
      @Override
      public void onUpdatesInvalidated(TelegramApi api) {
        // When api engine expects that update sequence might be broken
      }
    });

    TLConfig config = api.doRpcCall(new TLRequestHelpGetConfig());
  }
}
SireInsectus commented 10 years ago

And I guess I left out of that, sample implementations of AbsApiState, AppInfo and Authorizer

SireInsectus commented 10 years ago

If you can help me get started, I would be more than willing to contribute "samples" back in both code and documentation. Having them will help expedite adoption of your APIs.

AurelioB commented 10 years ago

I agree, a demo would really help. I tried following the app's implementation of telegram-api without success.

ex3ndr commented 10 years ago

I'll try to create samples and provide some useful tips as fast as i can. For now i am working on Telegram S application.

SireInsectus commented 10 years ago

I would be more than happy to help here if you can help us figure out why we cannot register for an api_id... My only alternative would be to use the api_id from Telegram S.

-/\/---------/\/\ //\/\UNCHIE-//\/\ONSTER.com Jacob-D-Parr--|--559-640-7277 General-Manager-/-Owner www.MunchieMonster.com http://www.munchiemonster.com/

On Mon, Mar 3, 2014 at 12:46 PM, Stepan Korshakov notifications@github.comwrote:

I'll try to create samples and provide some useful tips as fast as i can. For now i am working on Telegram S application.

Reply to this email directly or view it on GitHubhttps://github.com/ex3ndr/telegram-api/issues/4#issuecomment-36557509 .

SireInsectus commented 10 years ago

Any chance of solving everyone's problem of getting an api_id so that we can help you with this?

ex3ndr commented 10 years ago

We are trying to implement updated app_id registration mechanism. For the first time you are able to use app ids that you may find in some our apps at GitHub.

SireInsectus commented 10 years ago

We appreciate that very much! We didn't want to use those other IDs without your blessing.

-/\/---------/\/\ //\/\UNCHIE-//\/\ONSTER.com Jacob-D-Parr--|--559-640-7277 General-Manager-/-Owner www.MunchieMonster.com http://www.munchiemonster.com/

On Tue, Mar 11, 2014 at 10:18 AM, Stepan Korshakov <notifications@github.com

wrote:

We are trying to implement updated app_id registration mechanism. For the first time you are able to use app ids that you may find in some our apps at GitHub.

Reply to this email directly or view it on GitHubhttps://github.com/ex3ndr/telegram-api/issues/4#issuecomment-37322898 .

SireInsectus commented 10 years ago

This is the beauty of open source project... A project specifically for telegram-api samples:

https://github.com/SireInsectus/telegram-api-samples

contecavour65 commented 10 years ago

Excuse me, i'm new on Eclipse and Java language. How can i to do:

To get started create a single working folder (ie "telegram"). Then clone into that folder each of the following projects::

telegram-api - same name telegram-mt - rename the folder "mtproto" telegram-tl-core - rename the folder "tl-core" telegram-api-samples - same name There are some minor build issues in how Gradle is configured that might cause some people problems in the core projects. Until those changes are merged into the main branch, please feel free to use my forks of the following projects:

SireInsectus/telegram-api SireInsectus/telegram-mt SireInsectus/telegram-tl-core

Thanks

coronapankaj commented 10 years ago

@contecavour65 can you get any solution above all are android studio project they will not import in eclipse

contecavour65 commented 10 years ago

There is some example to use all in eclipse? I'd llike to try to send message from a PC. HAve you some working example code? Thanks

contecavour65 commented 10 years ago

@coronapankaj If i install Android Studio and follw guidelines all works? I must intall Gradle in AndroidStudio?

Thanks