Android Browser Proxy App - Developer Documentation

Technical details for understanding and extending the application

Architecture Overview

The Android Browser Proxy App follows a modular architecture with clear separation of concerns. The main components are:

Browser Management Layer

Handles launching and controlling browser instances

Proxy Configuration Layer

Manages proxy settings and rotation

Integration Layer

Connects browser and proxy components

User Interface Layer

Provides user interaction

Core Components

BrowserManager

Responsible for launching and managing browser instances using Android's Intent system.

public class BrowserManager {
    // Launches a browser with specified URL and proxy configuration
    public int launchBrowser(String url, ProxyConfig proxyConfig, String browserPackage);
    
    // Closes a browser instance
    public boolean closeBrowser(int instanceId);
    
    // Gets a list of all active browser instances
    public List<BrowserInstance> getActiveBrowsers();
    
    // Other methods...
}

ProxyManager

Handles proxy configuration, testing, and rotation.

public class ProxyManager {
    // Gets a free proxy configuration
    public ProxyConfig getFreeProxy();
    
    // Gets multiple free proxy configurations
    public List<ProxyConfig> getFreeProxies(int count);
    
    // Rotates the proxy for a browser instance
    public ProxyConfig rotateProxy(int instanceId);
    
    // Other methods...
}

ProxyConfigurationService

Integrates browser automation and proxy management.

public class ProxyConfigurationService {
    // Launches multiple browser instances with free proxies
    public int launchBrowsersWithFreeProxies(String url, String browserPackage, int count);
    
    // Rotates proxies for all active browser instances
    public int rotateAllProxies();
    
    // Other methods...
}

MainActivity

Provides the user interface for interacting with the app.

Data Models

BrowserInstance

Represents a browser instance with its configuration and status.

public class BrowserInstance {
    private int instanceId;
    private String browserPackage;
    private String currentUrl;
    private ProxyConfig proxyConfig;
    private BrowserStatus status;
    private long launchTime;
    
    // Getters and setters...
}

ProxyConfig

Represents a proxy configuration with connection details.

public class ProxyConfig {
    private String host;
    private int port;
    private String username;
    private String password;
    private ProxyType type;
    private String country;
    private String city;
    private long rotationInterval;
    
    // Getters and setters...
}

Proxy Implementation

For Non-Rooted Devices

On non-rooted devices, the app uses system properties to configure proxies:

// Apply proxy configuration
System.setProperty("http.proxyHost", proxyConfig.getHost());
System.setProperty("http.proxyPort", String.valueOf(proxyConfig.getPort()));
System.setProperty("https.proxyHost", proxyConfig.getHost());
System.setProperty("https.proxyPort", String.valueOf(proxyConfig.getPort()));

This approach requires Android 7.0 (API level 24) or higher.

Free Proxy Integration

The app includes a FreeProxyProvider class that manages free proxy retrieval and testing:

public class FreeProxyProvider {
    // Gets a list of free proxies
    public List<ProxyConfig> getFreeProxies(int count);
    
    // Gets a list of free proxies from a specific country
    public List<ProxyConfig> getFreeProxiesByCountry(String country, int count);
    
    // Tests a proxy configuration
    public boolean testProxy(ProxyConfig proxyConfig);
}

Browser Automation

The app uses Android's Intent system to launch browser instances:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
intent.setPackage(browserPackage);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);

Testing Framework

The app includes a comprehensive testing framework:

public class AppFunctionalityTest {
    // Tests multiple browser instances
    public TestResult testMultipleBrowserInstances(String url, String browserPackage, int instanceCount);
    
    // Tests proxy rotation
    public TestResult testProxyRotation(String url, String browserPackage, int instanceCount);
    
    // Other test methods...
}

Extension Points

Adding New Proxy Providers

To add a new proxy provider:

  1. Create a new class that implements similar methods to FreeProxyProvider
  2. Integrate it with the ProxyManager class

Supporting Additional Browsers

The app already supports common browsers (Chrome, Firefox, Samsung Internet, etc.). To add support for additional browsers:

  1. Add the package name to the BrowserManager class
  2. Ensure the browser supports the standard Intent system for URL loading

Performance Considerations

  • Memory Usage: Each browser instance consumes significant memory. The app limits the number of concurrent instances to avoid excessive memory usage.
  • Battery Impact: Multiple browser instances can drain the battery quickly. The app includes options to limit the runtime of instances.
  • Network Usage: Proxy connections may increase data usage. Users should be aware of potential data charges.

Security Considerations

  • Proxy Authentication: The app supports proxy authentication but stores credentials only in memory, not persistently.
  • URL Handling: The app validates URLs before launching browsers to prevent potential security issues.
  • Permissions: The app requires minimal permissions, primarily internet access.

Building and Deploying

Requirements

  • Android Studio 4.0+
  • Android SDK with API level 24+
  • Gradle 7.0+

Build Instructions

  1. Clone the repository
  2. Open the project in Android Studio
  3. Sync Gradle files
  4. Build the project using the "Build" menu

Deployment

  1. Generate a signed APK using Android Studio
  2. Distribute the APK through your preferred channel

Troubleshooting Development Issues

  • Proxy Configuration Failures: Ensure the device is running Android 7.0+ and has internet connectivity.
  • Browser Launch Issues: Verify that the specified browser package is installed on the device.
  • Intent Handling: Some custom ROMs may have modified Intent handling. Test on standard Android devices.

This developer documentation provides a comprehensive overview of the Android Browser Proxy App's architecture, components, and implementation details. It serves as a guide for understanding, maintaining, and extending the application.