No exceptions on Android. On uwp its working fine.
I added a Xamarin Forms (Xamarin 5) project inside the solution of the Matrix-vNext xamarin-tls branch.
Here is my code:
BTW thanks for all your support,
Nicholas
I added a Xamarin Forms (Xamarin 5) project inside the solution of the Matrix-vNext xamarin-tls branch.
Here is my code:
- using System;
- using Xamarin.Forms;
- using System.Reactive.Linq;
- using Matrix;
- using Matrix.Extensions.Client.Roster;
- using Matrix.Extensions.Client.Presence;
- using Matrix.Xmpp;
- using Matrix.Xmpp.Base;
- using System.Diagnostics;
- using Matrix.Network.Resolver;
- using System.Net;
- using Matrix.Tls.Mono;
- using System.Threading.Tasks;
- namespace AppClient
- {
- public partial class App : Application
- {
- private XmppClient xmppClient;
- public App()
- {
- InitializeComponent();
- }
- protected override void OnStart()
- {
- Task.Run(async () => {
- {
- Username = "entersoft",
- Password = "testtest",
- XmppDomain = "xmpp.jp",
- };
- if (Device.RuntimePlatform != Device.UWP)
- {
- }
- xmppClient.XmppSessionStateObserver.Subscribe(v => {
- Debug.WriteLine($"State changed: {v}");
- });
- xmppClient
- .XmppXElementStreamObserver
- .Subscribe(el =>
- {
- Debug.WriteLine(el.ToString());
- });
- xmppClient
- .XmppXElementStreamObserver
- .Subscribe(el =>
- {
- Debug.WriteLine(el.ToString());
- });
- xmppClient
- .XmppXElementStreamObserver
- .Subscribe(el =>
- {
- Debug.WriteLine(el.ToString());
- });
- // Connect the XMPP connection
- await xmppClient.ConnectAsync();
- // request the roster (aka contact list)
- var roster = await xmppClient.RequestRosterAsync();
- Debug.WriteLine(roster.ToString());
- // Send our presence to the server
- xmppClient.SendPresenceAsync(Show.Chat, "free for chat").GetAwaiter().GetResult();
- });
- }
- protected override async void OnSleep()
- {
- await xmppClient.DisconnectAsync();
- }
- protected override void OnResume()
- {
- }
- }
- }
BTW thanks for all your support,
Nicholas
This post was edited on 2021-09-07, 15:54 by Alex.