Buggy code:
private static final String TAG = "LocationUpdateService" ; private static final String STATIONARY_REGION_ACTION = "com.tenforwardconsulting.cordova.bgloc.STATIONARY_REGION_ACTION" ; private static final String STATIONARY_ALARM_ACTION = "com.tenforwardconsulting.cordova.bgloc.STATIONARY_ALARM_ACTION" ; private static final String SINGLE_LOCATION_UPDATE_ACTION = "com.tenforwardconsulting.cordova.bgloc.SINGLE_LOCATION_UPDATE_ACTION" ; private static final String STATIONARY_LOCATION_MONITOR_ACTION = "com.tenforwardconsulting.cordova.bgloc.STATIONARY_LOCATION_MONITOR_ACTION" ; private static final long STATIONARY_TIMEOUT = ( 5 * 1000 ) * 60 ; private static final long STATIONARY_LOCATION_POLLING_INTERVAL_LAZY = ( 3 * 1000 ) * 60 ; private static final long STATIONARY_LOCATION_POLLING_INTERVAL_AGGRESSIVE = ( 1 * 1000 ) * 60 ; private static final Integer MAX_STATIONARY_ACQUISITION_ATTEMPTS = 5 ; private static final Integer MAX_SPEED_ACQUISITION_ATTEMPTS = 3 ; private WakeLock wakeLock ; private Location lastLocation ; private long lastUpdateTime = 0L ; private JSONObject params ; private JSONObject headers ; private String url = "http:////192.168.2.15:3000//users//current_location.json" ; private float stationaryRadius ; private Location stationaryLocation ; private PendingIntent stationaryAlarmPI ; private PendingIntent stationaryLocationPollingPI ; private long stationaryLocationPollingInterval ; private PendingIntent stationaryRegionPI ; private PendingIntent singleUpdatePI ; private Boolean isMoving = false ; private Boolean isAcquiringStationaryLocation = false ; private Boolean isAcquiringSpeed = false ; private Integer locationAcquisitionAttempts = 0 ; private Integer desiredAccuracy = 100 ; private Integer distanceFilter = 30 ; private Integer scaledDistanceFilter ; private Integer locationTimeout = 30 ; private Boolean isDebugging ; private String notificationTitle = "Background<seq2seq4repair_space>checking" ; private String notificationText = "ENABLED" ; private Boolean stopOnTerminate ; private ToneGenerator toneGenerator ; private Criteria criteria ; private LocationManager locationManager ; private AlarmManager alarmManager ; private ConnectivityManager connectivityManager ; private NotificationManager notificationManager ; public static TelephonyManager telephonyManager = null ; @ Override public void onCreate ( ) { } @ Override public int onStartCommand ( Intent intent , int flags , int startId ) { } @ TargetApi ( 16 ) private Notification buildForegroundNotification ( Notification . Builder builder ) { } @ SuppressWarnings ( "deprecation" ) @ TargetApi ( 15 ) private Notification buildForegroundNotificationCompat ( Notification . Builder builder ) { } @ Override public boolean stopService ( Intent intent ) { } private void setPace ( Boolean value ) { } private Integer translateDesiredAccuracy ( Integer accuracy ) { } public Location getLastBestLocation ( ) { } public void onLocationChanged ( Location location ) { } private void startTone ( String name ) { } public void resetStationaryAlarm ( ) { } private Integer calculateDistanceFilter ( Float speed ) { } private void startMonitoringStationaryRegion ( Location location ) { } public void startPollingStationaryLocation ( long interval ) { } public void onPollStationaryLocation ( Location location ) { } public void onExitStationaryRegion ( Location location ) { } public void onCellLocationChange ( CellLocation cellLocation ) { } private BroadcastReceiver singleUpdateReceiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { } } ; private BroadcastReceiver stationaryAlarmReceiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { } } ; private BroadcastReceiver stationaryLocationMonitorReceiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { } } ; private BroadcastReceiver stationaryRegionReceiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { } } ; private PhoneStateListener phoneStateListener = new PhoneStateListener ( ) { @ Override public void onCellLocationChanged ( CellLocation location ) { } } ; public void onProviderDisabled ( String provider ) { } public void onProviderEnabled ( String provider ) { } public void onStatusChanged ( String provider , int status , Bundle extras ) { } private void schedulePostLocations ( ) { } private boolean postLocation ( com . tenforwardconsulting . cordova . bgloc . data . Location l , LocationDAO dao ) { if ( l == null ) { Log . w ( LocationUpdateService . TAG , "postLocation:<seq2seq4repair_space>null<seq2seq4repair_space>location" ) ; return false ; } try { lastUpdateTime = SystemClock . elapsedRealtime ( ) ; Log . i ( LocationUpdateService . TAG , ( "Posting<seq2seq4repair_space>native<seq2seq4repair_space>location<seq2seq4repair_space>update:<seq2seq4repair_space>" + l ) ) ; JSONObject location = new JSONObject ( ) ; location . put ( "latitude" , l . getLatitude ( ) ) ; location . put ( "longitude" , l . getLongitude ( ) ) ; location . put ( "accuracy" , l . getAccuracy ( ) ) ; location . put ( "speed" , l . getSpeed ( ) ) ; location . put ( "bearing" , l . getBearing ( ) ) ; location . put ( "altitude" , l . getAltitude ( ) ) ; location . put ( "recorded_at" , dao . dateToString ( l . getRecordedAt ( ) ) ) ; params . put ( "location" , location ) ; Log . i ( LocationUpdateService . TAG , ( "location:<seq2seq4repair_space>" + ( location . toString ( ) ) ) ) ; String message_string = location . toString ( ) ; for ( int i = ( mClients . size ( ) ) - 1 ; i >= 0 ; i -- ) { try { <START_BUG> mClients . get ( i ) . send ( Message . obtain ( null , LocationUpdateService . MSG_UPDATE_LOCATION , message_string , 0 ) ) ; <END_BUG> } catch ( RemoteException e ) { mClients . remove ( i ) ; } } return true ; } catch ( Throwable e ) { Log . w ( LocationUpdateService . TAG , ( "Exception<seq2seq4repair_space>posting<seq2seq4repair_space>location:<seq2seq4repair_space>" + e ) ) ; e . printStackTrace ( ) ; return false ; } } private void persistLocation ( Location location ) { } private boolean isNetworkConnected ( ) { } @ Override public void onDestroy ( ) { } private void cleanUp ( ) { } @ TargetApi ( VERSION_CODES . ICE_CREAM_SANDWICH ) @ Override public void onTaskRemoved ( Intent rootIntent ) { } private class PostLocationTask extends AsyncTask < Object , Integer , Boolean > { @ Override protected Boolean doInBackground ( Object ... objects ) { } @ Override protected void onPostExecute ( Boolean result ) { } } }

Fix:
mClients . get ( i ) . send ( Message . obtain ( null , LocationUpdateService . MSG_UPDATE_LOCATION , 0 , 0 , message_string ) ) ;