how to set proxy for all connections in an android app?

772 Views Asked by At

I want to use this library for playing some youtube video in my android app. but in my country youtube is blocked. I want to use proxy or anything else, only for my app to solving this problem.

I tried this code but all connections is Failed except admob ads(maybe because of use google play service):

    System.setProperty("http.proxyHost", proxyHost);
    System.setProperty("http.proxyPort", proxyPort);
    System.setProperty("https.proxyHost", proxyHost);
    System.setProperty("https.proxyPort", proxyPort);

I also try this library but all connections lost in my app. is there a way to use proxy for all connections in my app only, and not all device?

0

There are 0 best solutions below