How can my app keep connected to a network without internet connection?

WelingtonBRWelingtonBR Member ✭✭
edited March 14 in Xamarin.Forms

Hello,

My app must connect to a network (which don't have access to internet) programatically, how ever the smartphone go back the last network automatically. How can I avoid that?

It seems that priority is not working.

Edit: I'm using xamarin.forms, but i'm having this issue just with android.
Best Regards,

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    A typical iphone can be on both LTE and Wifi at the same time.
    So it gets internet through your phone carrier (LTE/data service) - while still being able to connect to items withing the private wifi network.

    So are you sure its actually switching and not simply using different paths of connection for different needs?

  • WelingtonBRWelingtonBR Member ✭✭
    edited March 14

    @ClintStLaurent said:
    A typical iphone can be on both LTE and Wifi at the same time.
    So it gets internet through your phone carrier (LTE/data service) - while still being able to connect to items withing the private wifi network.

    So are you sure its actually switching and not simply using different paths of connection for different needs?

    Thank you for your reply.

    My code is almost exactly like this: https://spin.atomicobject.com/2018/02/15/connecting-wifi-xamarin-forms/

    I'm getting problems with Android.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Android does the same. You can be on Wifi and LTE... and even have a wifi-direct device connected all at the same time. I do it all day, every day while developing.

    My code is almost exactly like this

    That doesn't answer my question. I'm asking what you do you know as fact.

    how ever the smartphone go back the last network automatically.

    How are you coming to that conclusion? How are you determining that it is switching networks? As apposed to using wifi network for one thing, and phone data network for internet.

  • WelingtonBRWelingtonBR Member ✭✭

    @ClintStLaurent said:

    So it gets internet through your phone carrier (LTE/data service) - while still being able to connect to items withing the private wifi network.

    So are you sure its actually switching and not simply using different paths of connection for different needs?

    I'm turning off mobile data manually(LTE/3G),I'm connecting to another SSID and I have just one active TCP Socket on the new network (smartphone <--> device), so I believe that i'm actually switching.

    Android does the same. You can be on Wifi and LTE... and even have a wifi-direct device connected all at the same time. I do it all day, every day while developing.

    How are you coming to that conclusion? How are you determining that it is switching networks? As apposed to using wifi network for one thing, and phone data network for internet.

    I can check configurations->wifi on the smartphone (moto z2 play api26). The connected network go back to the network which has internet connectivity, even while the tcp socket is connected.

    In another case, while mobile data is on, I realized that my tcp socket didn't worked properly. I imagine that the smartphone was trying to reach my device (192.168.1.4 :7000) using mobile data, and not the Wifi network (which don't have internet connectivity).

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I'm turning off mobile data manually(LTE/3G),I'm connecting to another SSID

    Test:
    Turn on airplane mode.
    Then turn on wifi

    You are then guaranteed to not use phone carrier services.

  • WelingtonBRWelingtonBR Member ✭✭
    edited March 14

    Test:
    Turn on airplane mode.
    Then turn on wifi

    You are then guaranteed to not use phone carrier services.

    Before I turn on the airplane mode, i had removed the device wifi(which on that don't have internet connection...) from configured networks. This solved the issues about going back do previous wif network. Any ideia why this?

    I still having one problem, while mobile data is enabled:

    case 1: with mobile data enabled

    I can connect programmatically to a wifi network but I can not establish the TCP Socket. This wifi network don't provide internet connectivity. How to avoid that?

    case 2: with airplane mode enabled and mobile data off.
    I can connect programmatically to a wifi network and everythings happen exactly the same as airplane mode off.

  • WelingtonBRWelingtonBR Member ✭✭

    Hi, I stiil having the issue:

    I need to connect to a Wifi network which don't have internet connectivity but the smartphone go back to the last wifi network which had internet connectivity, so I can not send my data through TCP socket.

    Does anyone can help me?

Sign In or Register to comment.