I am working on an application which needs to get my router’s IP.
The following sketch works in JAVA.
Before running in Android, I checked the Internet option under Permissions.
With ANDROID, it compiles OK but does not work. I get a long error message, beginning with:
" (HTTPLog)-Static: isSBSettingEnabled false
java.io.IOException: Cleartext HTTP traffic to checkip.dyndns.com not permitted
………".
Thanks for any idea.
my sketch:
String ExtIP;
PFont font;
int Green=#4EFA2D;
void setup() {
size(400,200);
String[] lines = loadStrings(“http://checkip.dyndns.com”);
println(“there are " + lines.length + " lines”);
for (int i = 0 ; i < lines.length; i++) {
println(lines[i]);
}
ExtIP=lines[0];
ExtIP=ExtIP.substring(ExtIP.indexOf(“ss:”));
ExtIP=ExtIP.substring(4, ExtIP.indexOf("</"));
println(ExtIP);
font= createFont(“arial Bold”,32);
fill(Green);
textFont(font);
text(ExtIP,10,100);
}
void draw() {
}