{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Kotlogram","type":"basic","slug":"kotlogram","excerpt":"com.github.badoualy.telegram.api.Kotlogram","body":"This class is the main entry point of the library, this is the first class that you should be using.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Create a new client\"\n}\n[/block]\nThe easiest way is\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Kotlogram.getDefaultClient(application, new TelegramApiStorageImpl());\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nHere, the `TelegramApiStorageImpl` is not detailed, but your implementation should persist info in persistent memory (DB, file, ...).\n\nOr, you may also use this method overloads\n- `preferredDataCenter`: if you want to try connecting to a specific datacenter first (for example, if you know your closest dc). It could save some exchange (a few ms...) while creating the first client.\n- `updateCallback`: callback called when an update is received from Telegram (new message, new group created, new friend joined Telegram, ...).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Get a specific DataCenter\"\n}\n[/block]\nYou can use `getDcById` method or `getDcId` methods :)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Get API layer at runtime\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"int layer = Kotlogram.API_LAYER;\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Clean up\"\n}\n[/block]\nOnce you're done, and you closed all your clients, to let your process finish, call:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Kotlogram.cleanUp();\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]","updates":[],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"57e382eef727c41700002012","user":"5631f962c3b04b0d00ba9bf1","__v":0,"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Api module","slug":"api-module","order":4,"from_sync":false,"reference":false,"_id":"57e0f14b8929550e00f1d9bc","createdAt":"2016-09-20T08:20:27.114Z","__v":0,"version":"5703d527bb69fc1700553ce3","project":"5703d527bb69fc1700553ce0"},"createdAt":"2016-09-22T07:06:22.842Z","parentDoc":null,"githubsync":"","project":"5703d527bb69fc1700553ce0","version":{"version":"0.0.6","version_clean":"0.0.6","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["5703d527bb69fc1700553ce4","5703d8b7aceacc17003ef303","5703e60b6116142000db25f6","57e0db616a1c2e0e0081fe64","57e0f141ff540c22007b45fa","57e0f14b8929550e00f1d9bc"],"_id":"5703d527bb69fc1700553ce3","createdAt":"2016-04-05T15:09:27.620Z","hasDoc":true,"releaseDate":"2016-04-05T15:09:27.620Z","__v":6,"hasReference":true,"project":"5703d527bb69fc1700553ce0"}}

Kotlogram

com.github.badoualy.telegram.api.Kotlogram

This class is the main entry point of the library, this is the first class that you should be using. [block:api-header] { "type": "basic", "title": "Create a new client" } [/block] The easiest way is [block:code] { "codes": [ { "code": "Kotlogram.getDefaultClient(application, new TelegramApiStorageImpl());", "language": "java" } ] } [/block] Here, the `TelegramApiStorageImpl` is not detailed, but your implementation should persist info in persistent memory (DB, file, ...). Or, you may also use this method overloads - `preferredDataCenter`: if you want to try connecting to a specific datacenter first (for example, if you know your closest dc). It could save some exchange (a few ms...) while creating the first client. - `updateCallback`: callback called when an update is received from Telegram (new message, new group created, new friend joined Telegram, ...). [block:api-header] { "type": "basic", "title": "Get a specific DataCenter" } [/block] You can use `getDcById` method or `getDcId` methods :) [block:api-header] { "type": "basic", "title": "Get API layer at runtime" } [/block] [block:code] { "codes": [ { "code": "int layer = Kotlogram.API_LAYER;", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "Clean up" } [/block] Once you're done, and you closed all your clients, to let your process finish, call: [block:code] { "codes": [ { "code": "Kotlogram.cleanUp();", "language": "java" } ] } [/block]