Profile cover photo
Profile photo
Jim Jeffers
267 followers
267 followers
About
Jim's posts

Post has attachment
Hey there,

I have an AsyncTask that now hangs when I update my app to use Google Play services 7.8.0. The code was working without issue when my app was using 7.5.0. Any idea what might cause this to occur?

  private class QueryDataTask extends AsyncTask<Void, Void, DataReadResult> {
       @Override
        protected void onPreExecute() {
            super.onPreExecute();
            Log.d(TAG, "Executing query task");
        }

        protected DataReadResult doInBackground(Void... params) {
            Calendar date = new GregorianCalendar();
            date.set(Calendar.HOUR_OF_DAY, 0);
            date.set(Calendar.MINUTE, 0);
            date.set(Calendar.SECOND, 0);
            date.set(Calendar.MILLISECOND, 0);
            date.add(Calendar.DAY_OF_MONTH, 1);
            date.add(Calendar.SECOND, -1);
            long endTime = date.getTimeInMillis();

            date.add(Calendar.DAY_OF_MONTH, -15);
            long startTime = date.getTimeInMillis();

            DataReadRequest readRequest = new DataReadRequest.Builder()
              .aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
              .bucketByTime(1, TimeUnit.DAYS)
              .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
              .build();
              
            Log.d(TAG, "Sending Google Fit Task");
            return Fitness.HistoryApi.readData(mClient, readRequest).await(1, TimeUnit.MINUTES);
        }

       @Override
        protected void onPostExecute(DataReadResult dataReadResult) {
            Log.d(TAG, "Post Execute Google Fit Task");
        }
    }
Wait while more posts are being loaded