How to toggle airplane mode on android device programatically using android mode

Hi,
I have a project that takes images, logs those images to the SD card and uploads the images to an FTP server. This happens during the day only so i want the system to go into airplane mode at night. Is there a way to do this with processing android mode. The only examples i have found so far are for android studio and are very old and indicate that they only work up to API 16.

Any help is much appreciated.

Cheers.

Hi @katesfb,

If you read carefully the Android SDK documentation you will see, that this is only possible for system level apps since 4.2. So also processing android mode are not able to do this on user level apps.
You have 2 choices…

  • root your phone and install your app as system app
  • or use the connectivity interface to disable WiFi, Bluetooth and mobile data connection to achieve what I think what your intention is…
    For latter you need the WRITE_SETTINGS permission.

Cheers
— mnse

1 Like

HI @mnse,
And thanks for the reply, much appreciated.

Yes i just want to disable radio connections for a period of time. Is there any example code to disable WIFI, BT and mobile data connection. I suppose WIFI and BT could be toggled using the Ketai library but what about the mobile data connection.

Any help is much appreciated.

Cheers.

1 Like

Hi
Maybe this helps

1 Like