Layer 220
AccountRegisterDevice
Register device to receive PUSH notifications
method
Users
account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<long> = Bool;
Parameters
| Name | Type | Description |
|---|---|---|
| Flags | # | Flags, see TL conditional fields |
| NoMuted | flags.0?true | Avoid receiving (silent and invisible background) notifications. Useful to save battery. |
| TokenType | int | Device token type, see PUSH updates for the possible values. |
| Token | string | Device token, see PUSH updates for the possible values. |
| AppSandbox | Bool | If (bool True) is transmitted, a sandbox-certificate will be used during transmission. |
| Secret | bytes | For FCM and APNS Vo IP, optional encryption key used to encrypt push notifications |
| OtherUids | Vector<long> | List of user identifiers of other users currently using the client |
Returns
BoolPossible Errors
| Code | Type | Description |
|---|---|---|
| 400 | TOKEN_EMPTY | The specified token is empty. |
| 400 | TOKEN_INVALID | The provided token is invalid. |
| 400 | TOKEN_TYPE_INVALID | The specified token type is invalid. |
| 400 | WEBPUSH_AUTH_INVALID | The specified web push authentication secret is invalid. |
| 400 | WEBPUSH_KEY_INVALID | The specified web push elliptic curve Diffie-Hellman public key is invalid. |
| 400 | WEBPUSH_TOKEN_INVALID | The specified web push token is invalid. |
Gogram Example
// AccountRegisterDevice - using Params struct result, err := client.AccountRegisterDevice(&tg.AccountRegisterDeviceParams{ TokenType: 0, Token: "...", AppSandbox: true, Secret: []byte{}, OtherUids: []long{}, // Optional fields: // NoMuted: true, }) if err != nil { // handle error } // result is *tg.Bool