intentservice

How is an Intent Service Declared in the Android Manifest?

こ雲淡風輕ζ 提交于 2019-11-26 11:16:29
问题 Straight forward question: Is an IntentService declared in the Android Manifest as a regular service, or is there another way? It tried searching for it, but I couldn\'t find the answer. Here is the regular Service declaration: <service android:name=\".NameOfService\"> </service> Thanks 回答1: In your manifest you declare a service with android:name=".Communication" , this means that your service class should be located in com.exercise.AndroidClient.Communication Check that the packages are

send intent from service to activity

心已入冬 提交于 2019-11-26 10:56:55
问题 I\'m trying to return the result from an IntentSerivce to the mainactivity using an intent, but I can\'t get it to work. The IntentService receives the intent from the activity without a problem, does it\'s thing and gets a JSONstring . Now the only problem left is to send this String back to the activity. Here is the method in the mainactivity: public String RTConn(String query){ System.out.println(\"Querying Rotten Tomatoes.\"); Intent rtIntent = new Intent(MainActivity.this, RTConnection

Android: Using WebView outside an Activity context

自作多情 提交于 2019-11-26 07:29:09
问题 I am trying to achieve Web Scraping through a background IntentService that periodically scrape a website without a view displaying on the users phone. Since I have to do call some javascript on the loaded page I cannot use any HttpGet\'s etc. I therefore have to use a WebView instance which can only run on an UI thread. Any attempts to start an Activity that use a WebView results in a View coming into the phones foreground (as per Android\'s design of Activities) Any attempts to use a

Android: keep Service running when app is killed

安稳与你 提交于 2019-11-26 03:08:32
问题 I want to keep a IntentService running in background even when the app is killed. And by \"killed\" I mean press home-button for a long time -> see all running apps -> swipe my app aside -> app killed OR press back-button for a long time -> app killed My code goes as follows. In my MainActivity: Intent intent = new Intent(this, MyService.class); this.startService(intent); In my MyService: public class MyService extends IntentService { @Override protected void onHandleIntent(Intent intent) {

Android - Start service on boot

五迷三道 提交于 2019-11-25 23:48:30
问题 From everything I\'ve seen on Stack Exchange and elsewhere, I have everything set up correctly to start an IntentService when Android OS boots. Unfortunately it is not starting on boot, and I\'m not getting any errors. Maybe the experts can help... Manifest: <?xml version=\"1.0\" encoding=\"utf-8\"?> <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"com.phx.batterylogger\" android:versionCode=\"1\" android:versionName=\"1.0\" android:installLocation=\