flyweb / flyweb-android

Android app for flyweb
2 stars 0 forks source link

Bug in "open external link in browser" feature #4

Closed kannanvijayan-zz closed 7 years ago

kannanvijayan-zz commented 7 years ago

Was just testing the "open external link in the browser" feature we recently added. The code works for FlyWeb services running on non-standard ports, but not for FlyWeb services running on port 80. For FlyWeb services running on port 80, the app tries to open the service URL directly in the default browser instead of the app's webview.

Steps to reproduce:

  1. Run a FlyWeb service on port 80
  2. Discover and connect to that service using FlyWeb app.
  3. App will request opening of external browser to handle service URL.

This is because the URI in the following code in BrowseActivity.java may return -1 for getPort():

if (mServiceInfo.getAddress().getHostAddress().equals(uri.getHost()) &&
    (mServiceInfo.getPort() == uri.getPort()))
{
   ...
}

This should be fixed so that if uri.getPort() is -1, then we use the port 80 as a comparison.

irenewchen commented 7 years ago

@kannan-vijayan Where can I find a service that opens links in a browser? Tried a couple, but either couldn't get it to work (FlyFile; was throwing exception in the console), not sure how to publish server (PhotoWall), or didn't find an external link (MP3, Quadcopter).

kannanvijayan-zz commented 7 years ago

I don't know if we explicitly have a demo which includes external links to an internet website. I usually test this using a small test folder containing a simple index.html file:

<html><body><a href="yahoo.com">yahoo</a></body></html>

A python SimpleHTTPServer serving it:

python -m SimpleHTTPServer 8080

Publish the service using avahi commandline utils:

avahi-publish -s "FlyWeb Test" _flyweb._tcp 8080

This is all that's required to create a small flyweb service that the app can see.

Do you have a linux machine? (You can use the RPi as one if you don't otherwise have one).

kannanvijayan-zz commented 7 years ago

Closed with ce4ee13b234adeb6ad1c96a254727312b9651429.