locked
How to use Telegram API for developing telegram client for windows phone 8 RRS feed

  • Question

  • Developing Telegram Client for Windows phone 8 platform , telegram doesnt provide API for windows phone then, what is being used by unofficial telegram client 

    developer
    like http://www.windowsphone.com/ru-ru/store/app/akragram/6b0e0d5d-2a1d-4720-968b-ae28664e623f

    http://www.windowsphone.com/en-us/store/app/migram-beta/36c719bc-5460-48b1-a61b-c276e9877a09

    http://www.windowsphone.com/en-us/store/app/ngram/945b96a7-aadc-4dd0-806a-c2d1e0e6ca9a

    http://www.windowsphone.com/en-us/store/app/kilogram/aec2e346-76d5-4bd5-a5be-57c915a46d86

    http://www.windowsphone.com/en-us/store/app/fluorogram/297f79f4-83e0-40be-b20b-8298c339faa5

    etc.


    Thank you!
    Saturday, February 15, 2014 11:43 AM

All replies

  • It looks like there is an API available

    http://www.programmableweb.com/api/telegram

    Saturday, February 15, 2014 1:50 PM
  • Thank you for Reply,

    I am very beginner to windows phone programming but i think Telegram API is in JAVA so windows phone is not supporting JAVA so for what I should use to develop telegram client , there is already telegram client for windows phone that i had mentioned in above question what there are using.?

    https://telegram.org/source

    Thank you


    Monday, February 17, 2014 4:05 AM
  • The Telegram API Ken linked is a REST web service API which can be called from clients of any language. See Communications for Windows Phone for information on connecting to REST services from Windows Phone 8 and the Portable HttpClient class for Windows Phone 8.

    --Rob

    Monday, February 17, 2014 5:50 AM
  • Thank you @ROB for valuable guidance ,

    can i have Documentation of Telegram REST API , I am confusing myself with https://github.com/DrKLO/Telegram

    they says API for Android ,and android is using JAVA , I had downloaded the API contains JAVA Code,please let me know if i am in wrong place. and it says on top that "Telegram for android source".

    I am very clear with API documentation located in https://core.telegram.org/api , but again source code contain JAVA Code.!!

    Thank you.

     
    Monday, February 17, 2014 11:35 AM
  • Hi! I am a developer of Ngram client. There is no official api for Telegram service. You need to use this documentation https://core.telegram.org/api to create your own.

    Thursday, February 27, 2014 8:33 AM
  • That is because you are looking at API for Android which is, obviously, in Java.

    Why would you think that an API for Android would work on Windows Phone? You can find all the documentation you need on the official Telegram website.


    Toni Petrina
    My blog: Toni codes .NET
    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful"

    Thursday, February 27, 2014 10:42 AM
  • Hey Respected Sir, I have some doubt regarding implementing telegram API in windows phone 8 thats C# langauge.
    I am reading https://core.telegram.org/api from last 20 days but not getting how to call those methods using c#.
    for example, in "User authorization" section they tells to use auth.sendCode method where https://core.telegram.org/method/auth.sendCode having 5 arguments , I am having very trouble to get API_ID and API_HASH .they are telling that establish TCP connection with 95.142.192.65:80.

    I am dealing with following C# code that respond me "Success" as String not API_ID or API_HASH that i want in auth.SentCode method. Other question in my mind is "auth" is object but where the library is there,there is no .dll from which i can inherit "auth" object.

    Thanking You.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Net.Sockets;
    using System.Threading;
    using System.Net;
    namespace SocketConn
    {   
        
        class SocketClient
        {
           
            Socket _socket = null;
    
           
            static ManualResetEvent _clientDone = new ManualResetEvent(false);
    
           
            const int TIMEOUT_MILLISECONDS = 5000;
    
           
            const int MAX_BUFFER_SIZE = 2048;
    
        
            public string Connect(string hostName, int portNumber)
            {
                string result = string.Empty;
    
                
                DnsEndPoint hostEntry = new DnsEndPoint(hostName, portNumber);
    
                
                _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
    
                
                SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
                socketEventArg.RemoteEndPoint = hostEntry;
    
                
                socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e)
                {
                
                    result = e.SocketError.ToString();
    
                
                    _clientDone.Set();
                });
    
                
                _clientDone.Reset();
    
                
                _socket.ConnectAsync(socketEventArg);
    
                
                _clientDone.WaitOne(TIMEOUT_MILLISECONDS);
    
                return result;
            }
    
            public string Send(string data)
            {
                string response = "Operation Timeout";
    
                
                if (_socket != null)
                {
                
                    SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
    
                
                    socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint;
                    socketEventArg.UserToken = null;
    
                    socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e)
                    {
                        response = e.SocketError.ToString();
    
    
                        _clientDone.Set();
                    });
    
    
                    byte[] payload = Encoding.UTF8.GetBytes(data);
                    socketEventArg.SetBuffer(payload, 0, payload.Length);
    
    
                    _clientDone.Reset();
    
    
                    _socket.SendAsync(socketEventArg);
    
                    _clientDone.WaitOne(TIMEOUT_MILLISECONDS);
                }
                else
                {
                    response = "Socket is not initialized";
                }
    
                return response;
            }
    
    
            public string Receive()
            {
                string response = "Operation Timeout";
    
         
                if (_socket != null)
                {
         
                    SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
                    socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint;
    
         
                    socketEventArg.SetBuffer(new Byte[MAX_BUFFER_SIZE], 0, MAX_BUFFER_SIZE);
                    socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e)
                    {
                        if (e.SocketError == SocketError.Success)
                        {
                    
                            response = Encoding.UTF8.GetString(e.Buffer, e.Offset, e.BytesTransferred);
                            response = response.Trim('\0');
                        }
                        else
                        {
                            response = e.SocketError.ToString();
                        }
    
                        _clientDone.Set();
                    });
    
                    
                    _clientDone.Reset();
    
                    
                    _socket.ReceiveAsync(socketEventArg);
    
                    _clientDone.WaitOne(TIMEOUT_MILLISECONDS);
                }
                else
                {
                    response = "Socket is not initialized";
                }
    
                return response;
            }
    
            /// <summary>
            /// Closes the Socket connection and releases all associated resources
            /// </summary>
            public void Close()
            {
                if (_socket != null)
                {
                    _socket.Close();
                }
            }
             
        }
    }
    

    Thursday, February 27, 2014 3:19 PM
  • Evgеniy, what's your email? need to hire their services
    Thursday, June 26, 2014 1:26 PM