android-intentservice

how to wait the volley response to finish it's work inside intentservice?

淺唱寂寞╮ 提交于 2019-12-06 15:33:51
问题 Working with intentservice to get the data of 7 Rss Feed links with using " Google Volley " in the background and use ResultReceiver to get the result , But I can't configure how to wait on the volley response to finish it's job to fire flag with ResultReceiver to display the data in the MainActivity 回答1: You shouldn't wait for it. You have two ways to make a network request: synchronous and asynchronous. If you use synchronous, you don't wait for result because the network call is a blocking

Oreo, default SMS App and ACTION_RESPOND_VIA_MESSAGE

情到浓时终转凉″ 提交于 2019-12-06 01:38:21
Applications targeting Android O have a couple of new rules when using services, one of them is that we can't start services while the application is in background. One of the requirements to be a default SMS application is: (from the Telephony.java javadoc) * <li>In a service, include an intent filter for {@link * android.telephony.TelephonyManager#ACTION_RESPOND_VIA_MESSAGE} * (<code>"android.intent.action.RESPOND_VIA_MESSAGE"</code>) with schemas, * <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and <code>mmsto:</code>. * This service must also require the {@link * android

OnHandleIntent() not called in IntentService

允我心安 提交于 2019-12-05 16:13:21
I know this question has been asked before, but I've been over all of the answers I could find and still haven't been able to solve the problem. The issue is that when by BroadcastReceiver starts the IntentService onHandleIntent() isn't called. Weirdly enough the constructor does run (as I can see by the Log output). This is my code: NoLiSeA.class (This class contains the BroadcastReceiver that starts my service) public void toProcess(StatusBarNotification sbn) { LocalBroadcastManager.getInstance(this).registerReceiver(notificationForwarder, new IntentFilter("to_forward")); Intent intent = new

How to keep an IntentService running even when app is closed?

筅森魡賤 提交于 2019-12-04 22:38:25
In my Android app I start an IntentService from within an Activity by calling startService(new Intent(this, MyService.class)); And it works like a charm. I can move between Activies, press the Home button to switch to other apps... and it's still working. But if I remove my app from the recents screen, my service is stopped. How can I avoid this? In other words, how can I keep my service running even if my app is closed from recent apps? My service code is as follows: public class MyService extends IntentService { public MyService() { super("MyService"); } @Override protected void

Android calling IntentService class from a Service Class

旧巷老猫 提交于 2019-12-04 06:32:32
问题 Can we call IntentService class from a running Service class . Intent myintentservice = new Intent(this, MyIntentService.class); startService(myintentservice); I using above lines of code in service class to start IntentService class. But then I get following error:- Process: objectdistance.ankeshkjaisansaria.ram.sita.cameratag, PID: 21823 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference at

setRepeating of AlarmManager not respond within the time indicated

你离开我真会死。 提交于 2019-12-04 06:30:05
问题 AlarmManager should be repeated every 1 minute, but repeated every 1, 2, 3 or 4 minutes. Since the application I throw AlarmManager public class PacienteApp extends Application { @Override public void onCreate() { AlarmManager gps = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(this, GpsReceiver.class); PendingIntent pending = PendingIntent.getBroadcast(this, 0, i, 0); gps.setRepeating(AlarmManager.RTC, System.currentTimeMillis(), 1000 * 60, pending); } }

Notification Android : Don't show notification when app is open?

本小妞迷上赌 提交于 2019-12-04 06:04:08
问题 I'm working on a project and I use Intent Service with wakefulBroadcastReceiver to schedule alarm and send notification. There are no problems this far. But I want when I open my app, it don't displaying notification again. Please any idea for this problem?. 回答1: In your notification receiver when you receive the notification you can check whether the app is in background or not and take a decision of showing the notification accordingly. Here's a code to check whether the app is in

Does intent go queue when calling startService for IntentService multiple times?

那年仲夏 提交于 2019-12-03 12:59:49
I want to download from internet with a IntentService . I pass a url through Intent to IntentService by calling startService(intentserive); . If I call startService for a various intents, do the intents go queue for download? The short answer to your question is YES. From the docs: IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. Clients send requests through startService(Intent) calls; the service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work. This "work queue

Geofencing : HTTP request failed while sending through the background service. Gives UnknownHostException

妖精的绣舞 提交于 2019-12-03 11:37:48
问题 I implemented Geofence in android application. I followed this link to implement 'Geofence' in app. I am using 'Retrofit' library to call 'HTTP' request. App has following permissions : <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android

Native crash in /system/lib/libart.so

走远了吗. 提交于 2019-12-03 05:39:01
I have an app on the Play Store, it has an IntentService that does some work when the app starts, and it's causing native crashes on Android 5.0. This service just scans the assets folder for app updating purposes. Specifically, this crash seems to happen on Samsung S5 after the ugrade to Lollipop, but I don't know if it's strictly related to that device, as it's an Italian app and here that's still the only widely diffuse (i.e. that I know of) device that's getting Lollipop. However, I tried it on the emulator, with stock Android 5, and it's working fine. I'm attaching the stack trace, any