Beispiel #1
0
 @Override
 public int onStartCommand(Intent intent, int flags, int startId) {
   android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
   int key = intent.getIntExtra("key", 0);
   String path = intent.getStringExtra("path");
   int maxHeight = intent.getIntExtra("maxHeight", 0);
   Bitmap tmpBitmap = decode(path);
   Bitmap resBitmap = null;
   if (tmpBitmap != null) {
     if (maxHeight != 0) {
       resBitmap =
           scaleBitmap(
               tmpBitmap, calculateSize(tmpBitmap.getWidth(), tmpBitmap.getHeight(), maxHeight));
     } else {
       resBitmap = tmpBitmap;
     }
   }
   String tmpFile = FileUtil.createTmpPngFile(resBitmap);
   publishResults(tmpFile, key, path);
   return Service.START_NOT_STICKY;
 }