SignalR hub connection failed while run the android emulator

60 views Asked by At

signalR hub in api project. And frontend i'm using maui app project,

I'm doing chat application through the maui with Signalr concept based.

(Example) User-1 send message to user-2 If send request hit first it will reach the api controller & controller will handle to direct the hub. This is was i'm doing here.

while run the application through the window's machine it will work quite good. But, while run through the android emulator its showing connection failed.I don't know why.

Actually i change the baseaddress also http://10.0.2.2. if click send button that event based method is there. Here i'm getting the message details but It will showing signalR connection failed something

Problem : While run the window's machine works. Why android emulator run time only it will show connection failed error i'm getting

1

There are 1 answers

0
Jason Pan On

Starting with Android 9 (API level 28), Android doesn't allow plaintext traffic (HTTP) by default, requiring apps to use HTTPS to enhance security during data transfer.

So for test environment, we can allow http traffic by setting android:usesCleartextTraffic="true" in your AndroidManifest.xml.

Sample:

<application
    ...
    android:usesCleartextTraffic="true"
    ...>
    ...
 </application>

Related link: Behavior changes: apps targeting API level 28+