Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger Hu committed Mar 5, 2018
1 parent f31cc5f commit a518719
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.support.v4.app.JobIntentService;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.RemoteInput;
import android.util.Log;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -44,6 +45,8 @@ public ImageDownloadService() {
// Download the image and create notification
@Override
protected void onHandleWork(@NonNull Intent intent) {
Log.d("DEBUG", "ImageDownloadService triggered");

// Extract additional values from the bundle
String imageUrl = intent.getStringExtra("url");
// Download image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.support.annotation.NonNull;
import android.support.v4.app.JobIntentService;
import android.support.v4.app.NotificationCompat;
import android.util.Log;

import com.codepath.example.servicesnotificationsdemo.DemoApplication;
import com.codepath.example.servicesnotificationsdemo.R;
Expand All @@ -29,11 +30,13 @@ public static void enqueueWork(Context context, Intent work) {
// This describes what will happen when service is triggered
@Override
protected void onHandleWork(@NonNull Intent intent) {
Log.d("DEBUG", "MySimpleService triggered");
timestamp = System.currentTimeMillis();
// Extract additional values from the bundle
String val = intent.getStringExtra("foo");
// Extract the receiver passed into the service
ResultReceiver rec = intent.getParcelableExtra("receiver");

// Sleep a bit first
sleep(3000);
// Send result to activity
Expand Down

0 comments on commit a518719

Please sign in to comment.