Android Question Change IP Address (Mobile)

hasexxl1988

Active Member
Licensed User
Longtime User
Hello,

is there any way (without root) to get the simcard offline? Or maybe that he gets the mobile data via the 2nd sim card for a short time and then switches back again?

I have searched here and also on Stakeoverflow, Google etc. but have not found anything useful.

I want the sim card to go offline so that I get a new IP address from the operator. This works with flight mode. However, I cannot change this via my own app (error). That no longer works since Android 4.x

Is there a way to deactivate/activate mobile data directly via App?

Or change the network technology? (3G, 4G, 5G) This may also change the IP address through the network switch.

Thanks
 

John Naylor

Active Member
Licensed User
Longtime User
According to me - Not as far as I know on any up to date Android versions.

According to ChatGPT -

On Android, controlling certain aspects like switching between SIM cards or modifying the mobile data state programmatically without root access has become significantly restricted due to security and privacy changes introduced in later versions of Android (starting from Android 4.x and strengthened in Android 6.x and beyond). Here's a breakdown of the possibilities:

1. Switching Mobile Data Between SIM Cards:​

  • Android does not provide a public API to directly manage dual SIM functionality, such as switching mobile data between SIM cards.
  • While some manufacturers might offer custom APIs for their devices (e.g., Samsung or Huawei), these are typically not universal across all devices, and accessing them would require manufacturer-level permissions or specific libraries that aren't generally accessible.

2. Toggling Mobile Data:​

  • From Android 5.x onwards, direct control of mobile data programmatically was deprecated. Therefore, you cannot enable/disable mobile data directly via an app unless you have root access.
  • Before Android 5.x, apps could modify mobile data state using hidden APIs, but this is no longer possible without user interaction.
  • You can only open the mobile data settings pageand ask the user to toggle it manually using an intent:

    java


    B4X:
    Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS);
    startActivity(intent);

    3. Changing Network Technology (3G/4G/5G):​

    • Android does not offer a public API for changing the network type (3G, 4G, 5G) programmatically without root.
    • This type of change can only be done via user settings, or in some cases, certain custom ROMs or specific device manufacturers might offer a method, but it’s not part of the official Android SDK.
    • Rooted devices could potentially access and modify system settings that control the network type.

    4. Getting a New IP Address:​

    • Airplane mode is a common way to force a disconnection, which typically results in a new IP address being assigned. However, airplane mode cannot be toggled programmatically since Android 4.x due to security restrictions.
    • As an alternative, manually toggling airplane mode or turning mobile data off and on from the device’s settings is the only way to achieve this without root.

    5. Rooted Device Options:​

    • If root access is available, there are ways to control mobile data, toggle airplane mode, or even switch SIM cards programmatically using root-access-based apps.

    6. Possible Workaround:

    • Automation apps like Tasker (with the appropriate plugins or root access) may allow you to switch mobile data or even manipulate network settings in a way that could achieve similar results.

    Conclusion:​

    Without root, your options are extremely limited, mainly due to Android's increased security restrictions. The best approach without root access is to guide users to manually switch data settings or change the network technology (e.g., 3G, 4G) via the settings interface.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…