Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7616835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:59:15+00:00 2026-05-31T02:59:15+00:00

My app connects with a persistent connection to a server. If the device is

  • 0

My app connects with a persistent connection to a server. If the device is currently using 3G it will connect over 3g.
The problem is that if it connected using 3G and moved into wifi the connection drops. How do I prevent it from disconnecting?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:59:16+00:00Added an answer on May 31, 2026 at 2:59 am

    Sounds like the server is unable to accommodate clients seamlessly switching to a different IP address, or it may be using something like keep-alive packets to maintain connection state, and when the 3G connection drops, it disconnects your session.

    This may not be something you have control over. From the Android point of view – the device will prefer WiFi depending on user preferences and you will likely not have any direct control over that either.

    In a nutshell – if you can’t modify or reconfigure the communications protocol to allow client IP changes on the fly, then there’s nothing you can do with Android to mitigate the problem.

    All mobile devices, and to a lesser extent, desktops/laptops will at some point change their public facing IP address, so it sounds like a bug or oversight in the server/protocol design to me.


    EDIT:

    In response to your comment, and in the interests of UX, you should be very careful about finding a way to force your app (possibly even the entire device) to remain on 3G when the user has requested that it use WiFi.

    Most people have capped data plans with their device and wouldn’t be very pleased if they think they are using WiFi (which is most likely free, or at least no additional cost) when in fact you’ve forced their device to continue using potentially very expensive 3G data instead.

    This is especially important when any method would likely be actively circumventing the reasonable limits the Android environment presents you with, and therefore would probably not be flagged as a “Service that costs you money” when installed.


    EDIT 2:

    So, there may be a way for you to do it, but it relies on unsupported, private Android APIs which may change at any moment – usual disclaimer applies.

    Take a look here where they access the ConnectivityManager object to allow you to enable mobile data.

    This method does require you to build against the Android source tree, and use a shared user ID with “system” so may or may not be suitable, but these APIs are private (as apps are not supposed to be able to do this without user action), but it may help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web app which connects to a server using a TCP connection
I'm developing an ASP.NET app (C#) that connect to SQL Server 2008 using ADO.NET
I have a Linux/c client app that connects to a WCF web service over
My app connects to the Schwab OFX server using NSURLConnection . Unfortunately the server
My App connects to a server and based on a cookie the server will
I'm trying to create an iPhone app that connects to FB using their API.
I’m currently creating an iOS app that uploads files to a server. As multiple
suppose a small app which connects to server and displays some data. The problem
I am writing front end app that connects to a DB and downloads any
I have a mobile app webservice client that connects to a WCF webservice(on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.