-1

is there a module or third party module for React Native that would allow me to write an app that would turn on/off mobile network after some task is done? I'm talking about Android devices.

Couldn't find anything in the documentation.

Cheers.

1 Answers1

1

I don't see this as a React native issue, basically, you need to write a Native Android plugin (Kotlin/Java) and call that from React native.

About turning off/on data it is not possible on non-rooted devices. I see it as an issue with the security aspects of the mobile device itself. Here is an answer that might help you clarify things - https://stackoverflow.com/a/31482526/1360730

Basically, you need the MODIFY_PHONE_STATE permission which is not given for 3rd party applications.

The closes possible thing would be to open up network settings.

Satheesh
  • 10,642
  • 6
  • 49
  • 91
  • ok, so instead of doing that programatically can I just simulate (open top bar and then tap on mobile data)? But then I would need to recognize if its already connected etc.. – somephpguy Oct 29 '21 at 14:31