A powerful Android application that allows users to switch between different network modes (5G Only, 5G Preferred, 4G Only) with a beautiful Material Design 3 interface.
- Network Mode Switching: Seamlessly switch between 5G Only, 5G Preferred, and 4G Only modes
- Quick Settings Tile: Access network modes directly from the Quick Settings panel
- Permission Management: Comprehensive permission handling with ADB and Shizuku support
- Material Design 3: Modern, beautiful UI following the latest Android design guidelines
- Dark/Light Theme: Automatic theme switching based on system preferences
- Setup Guide: Step-by-step instructions for granting required permissions
- Minimum SDK: Android 12 (API 31)
- Target SDK: Android 16 (API 36)
- Permissions: WRITE_SECURE_SETTINGS (granted via ADB or Shizuku)
- Enable Developer Options on your Android device
- Enable USB Debugging in Developer Options
- Connect your device to a computer with ADB installed
- Run the following command:
adb shell pm grant com.networkswitcher android.permission.WRITE_SECURE_SETTINGS
- Install Shizuku from Google Play Store
- Start Shizuku service (follow Shizuku's setup guide)
- Open Network Switch and grant permissions when prompted
The app follows modern Android development best practices:
- MVVM Architecture: ViewModel + LiveData for reactive UI
- Repository Pattern: Clean separation of data sources
- Coroutines: Asynchronous operations with proper lifecycle management
- Dependency Injection: Manual DI through Application class
- Material Design 3: Latest design system implementation
app/src/main/java/com/networkswitcher/
├── NetworkSwitchApplication.kt # Application class with DI setup
├── ui/
│ ├── MainActivity.kt # Main activity with network mode selection
│ ├── SetupGuideActivity.kt # Permission setup guide
│ └── viewmodel/
│ ├── MainViewModel.kt # Main screen logic
│ └── MainViewModelFactory.kt # ViewModel factory
├── service/
│ └── NetworkSwitchTileService.kt # Quick Settings Tile implementation
├── manager/
│ ├── NetworkModeManager.kt # Core network mode switching logic
│ └── PermissionManager.kt # Permission state management
├── data/
│ ├── model/
│ │ ├── NetworkMode.kt # Network mode enum
│ │ └── PermissionState.kt # Permission state enum
│ └── repository/
│ ├── SettingsRepository.kt # App settings persistence
│ └── NetworkRepository.kt # Network information
└── util/
└── Resource.kt # Result wrapper class
The app uses the following network mode values for Android's preferred_network_mode setting:
- 5G Only: 27 (NR_ONLY)
- 5G Preferred: 26 (NR_LTE_GSM_WCDMA)
- 4G Only: 11 (LTE_ONLY)
- Clone the repository or extract the project files
- Open in Android Studio Arctic Fox or later
- Sync Gradle files
- Build and run on device with Android 12+
The project uses the following key dependencies:
- AndroidX Core: Latest core libraries
- Material Design 3: Modern UI components
- Lifecycle Components: ViewModel and LiveData
- Shizuku API: For elevated permission handling
- Coroutines: Asynchronous programming
The project includes unit tests for core functionality:
./gradlew test- The app requires
WRITE_SECURE_SETTINGSpermission, which can only be granted via ADB or Shizuku - No sensitive data is stored or transmitted
- All operations are performed locally on the device
- Permission state is checked before each operation
- Minimum: Android 12 (API 31)
- Target: Android 16 (API 36)
- Tested on: Android 12, 13, 14, 15
- Architecture: ARM64, ARM, x86_64
- Ensure USB Debugging is enabled
- Verify ADB command was executed successfully
- Try revoking and re-granting the permission
- Check if your device supports the selected network mode
- Verify SIM card is inserted and active
- Some carriers may override network mode settings
- Add the tile to Quick Settings manually
- Check permission status in the main app
- Restart the app if tile appears inactive
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Shizuku: For providing elevated permission management
- Material Design Team: For the beautiful design system
- Android Development Team: For the comprehensive development platform
For issues and support:
- Check the troubleshooting section
- Review the setup guide in the app
- Open an issue on GitHub with device info and logs
Note: This app modifies system-level network settings and requires special permissions. Use responsibly and ensure you understand the implications of changing network modes on your device.