sivag1
sivag1

Reputation: 5004

Glass GDK HttpUrlConnection Service Not Available

I have this called in my Service that creates / updates live card.

URL url = new URL(url1);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();

I am getting Service Not Available. The URL works just fine in browser. I have the internet permission defined in the Manifest. What might be going on and what might be the fix?

Upvotes: 0

Views: 195

Answers (1)

sivag1
sivag1

Reputation: 5004

Ok, able to resolve this. Thanks to @Darren. Problem was, I was not using a new Thread or Async Task. Glass did not give the usual error that comes in Android like Network in Main thread exception. Instead gave weird exception like Service Not Available or sometimes just null.

Having the connection initiation in a new Thread resolved this.

Upvotes: 1

Related Questions