I am trying to achieve Web Scraping through a background IntentService that periodically scrape a website without a view displaying on the users phone.
I used the following code to get round this problem:
Handler handler = new Handler(Looper.getMainLooper()); try { handler.post( new Runnable() { @Override public void run() { ProcessRequest(); // Where this method runs the code you're needing } } ); } catch (Exception e) { e.printStackTrace(); }