Skip to content

Instantly share code, notes, and snippets.

@catehstn
Created July 17, 2016 22:59
Show Gist options
  • Save catehstn/0e9faa4f079279a8bb7a149de5ffd0b1 to your computer and use it in GitHub Desktop.
Save catehstn/0e9faa4f079279a8bb7a149de5ffd0b1 to your computer and use it in GitHub Desktop.
package co.ortatech.showandhide.service;
import android.app.IntentService;
import android.content.Intent;
import android.support.v4.content.LocalBroadcastManager;
import javax.inject.Inject;
import co.ortatech.showandhide.application.ShowAndHideApplication;
public class ImageProcessingService extends IntentService {
@Inject ImageProcessingServiceHelper helper;
public ImageProcessingService() {
super(ImageProcessingService.class.getName());
}
public ImageProcessingService(String name) {
super(name);
}
@Override
public void onCreate() {
super.onCreate();
((ShowAndHideApplication) getApplication()).component().inject(this);
}
@Override
protected void onHandleIntent(Intent workIntent) {
Intent localIntent = helper.handleAndReturnAppropriateIntent(workIntent,
this.getContentResolver());
// If the action fails, the intent can be null.
if (localIntent != null) {
LocalBroadcastManager.getInstance(this).sendBroadcast(localIntent);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment