android-intentservice

IntentService's onHandleIntent(Intent) gets null argument

房东的猫 提交于 2020-01-01 23:14:26
问题 I'm using an IntentService to run a background service for my app on android. Oddly I'm getting a lot of crash reports with cases where the intent passed to onHandleIntent is null. I'm not even sure how this is possible and seems extremely odd. Can anyone suggest why this might be happening? STACK_TRACE java.lang.NullPointerException at com.example.MyService.onHandleIntent(MyService.java:466) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os

Android : Not able to sync data between applications above Oreo + devices

删除回忆录丶 提交于 2020-01-01 19:22:37
问题 I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send

android design considerations: AsyncTask vs Service (IntentService?)

十年热恋 提交于 2019-12-28 01:42:26
问题 I'm designing an android app which will need to do the following steps: user pushes a button or otherwise indicates to "sync data". sync process will use REST web services to move data to and from the server. the data will be stored locally in a sqlite database. the sync process should provide status updates/messages to the UI the user should not be allowed to wander off to other parts of the application and do more work during the sync process. The first time the sync process runs, it may

Unable to update UI from IntentService

亡梦爱人 提交于 2019-12-25 08:53:37
问题 A seemingly simple requirement - to update UI from an IntentService . In the shot below, when the Start Service button is clicked, I need to show a ProgressBar above the only TextView and after a delay, remove the ProgressBar . Found a lot of answers on SO, but somehow unable to still crack it. I understand from this that LocalBroadcastManager is a good way to go. I have also tried following this, (an approach with Handler s), but it fails to show the ProgressBar too. Finally, based on this

IntentService does broadcast but onReceive doesn't receive broadcast

笑着哭i 提交于 2019-12-25 06:52:00
问题 (NOTE that at the end of this Question I have an EDIT in which I have replaced one method with what the Answer said to do in order to fix the problem of onReceive never getting called and added onDestroy to fix a new problem that cropped up after fixing first problem. ) Here's how I attempted to capture the broadcast data, but onReceive never gets called since Log.w never displays anything: public class MatchesActivity extends Activity implements DatabaseConnector.DatabaseProcessListener {

Android IntentService triggered with null intent

浪尽此生 提交于 2019-12-23 10:49:11
问题 I'm seeing a crash in Crashlytics: Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Intent.getIntExtra(java.lang.String, int)' on a null object reference at com.myapp.APKOfferQueueManagerIntentService.onHandleIntent(SourceFile:71) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.os.HandlerThread.run

Intent Service not working in doze mode

落爺英雄遲暮 提交于 2019-12-23 04:08:08
问题 One of my peer developer has written an intent service that makes an API call and then sleeps for 2 mins. After waking up, it sends again. Below is the code: public class GpsTrackingService extends IntentService { .... @Override protected void onHandleIntent(Intent intent) { do{ try{ //make API call here //then go to sleep for 2 mins TimeUnit.SECONDS.sleep(120); } catch(InterruptedException ex){ ex.printStackTrace(); } } while (preferences.shouldSendGps()); //till the user can send gps. } ...

Android IntentService can't instantiate class; no empty constructor

倾然丶 夕夏残阳落幕 提交于 2019-12-22 01:25:00
问题 I have a MainActivity class that needs to access an online API (thus using network resources). This requires a background thread that I've created in a separate file HttpRequestService.java . MainActivity.java: public class MainActivity extends Activity { public static final String API_KEY = "KEYKEYKEYKEYKEY"; public static final String CLIENT_ID = "IDIDIDIDIDIDID"; private final String BROADCAST_ACTION = "com.example.BROADCAST"; private final String EXTENDED_DATA_STATUS = "com.example.STATUS

Native crash in /system/lib/libart.so

大憨熊 提交于 2019-12-20 18:34:08
问题 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

Aquire partial wakelock in a IntentService

谁都会走 提交于 2019-12-20 07:37:51
问题 My IntentService gets fired from 2 places, either by an Alarm or by the Activity and since the duration is related to the amount of data it needs do fetch from the web, from what I understood, I need to keep a partial wakelock. Here's my implementation: @Override protected void onHandleIntent(Intent intent) { PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WakeLock"); try { wakeLock.setReferenceCounted(false