content: /*
   * Copyright (c) 2014 Amahi
   *
   * This file is part of Amahi.
   *
   * Amahi is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
   * Amahi is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with Amahi. If not, see <http ://www.gnu.org/licenses/>.
   */
  
  package org.amahi.anywhere.receiver;
  
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Build;
  import android.util.Log;
  
  import org.amahi.anywhere.util.Intents;
  
  /**
   * Camera new picture event receiver.
   */
  public class CameraReceiver extends BroadcastReceiver {
      @Override
      public void onReceive(Context context, Intent intent) {
          Log.e("NEW_IMAGE", "onReceive");
          Intent uploadService = Intents.Builder.with(context).buildUploadServiceIntent(intent.getData());
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
              context.startForegroundService(uploadService);
          } else {
              context.startService(uploadService);
          }
      }
  }
  