public void RegisterDeviceAsync(TLInt tokenType, TLString token, Action <TLBool> callback, Action <TLRPCError> faultCallback = null) { if (_activeTransport.AuthKey == null) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("Service is not initialized to register device") }); return; } var obj = new TLRegisterDevice { //TokenType = new TLInt(3), // MPNS //TokenType = new TLInt(8), // WNS //TokenType = new TLInt(11), // MPNS raw TokenType = tokenType, Token = token, AppSandbox = TLBool.False, Secret = TLString.Empty, OtherUids = new TLVector <TLInt>() }; const string methodName = "account.registerDevice"; Logs.Log.Write(string.Format("{0} {1}", methodName, obj)); SendInformativeMessage <TLBool>(methodName, obj, result => { Logs.Log.Write(string.Format("{0} result={1}", methodName, result)); callback.SafeInvoke(result); }, error => { Logs.Log.Write(string.Format("{0} error={1}", methodName, error)); faultCallback.SafeInvoke(error); }); }
public void RegisterDeviceAsync(TLInt tokenType, TLString token, Action <TLBool> callback, Action <TLRPCError> faultCallback = null) { if (_activeTransport.AuthKey == null) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("Service is not initialized to register device") }); return; } var systemVersion = _deviceInfo.SystemVersion; #if !WP8 if (!systemVersion.StartsWith("7.")) { systemVersion = "7.0.0.0"; } #endif var obj = new TLRegisterDevice { //TokenType = new TLInt(3), // MPNS //TokenType = new TLInt(8), // WNS TokenType = tokenType, Token = token, DeviceModel = new TLString(_deviceInfo.Model), SystemVersion = new TLString(systemVersion), AppVersion = new TLString(_deviceInfo.AppVersion), AppSandbox = TLBool.False, LangCode = new TLString(Utils.CurrentUICulture()) }; //Execute.ShowDebugMessage("account.registerDevice " + obj); SendInformativeMessage("account.registerDevice", obj, callback, faultCallback); }