Back to project page android.bigredsnapshot.
The source code is released under:
MIT License
If you think the Android project android.bigredsnapshot listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.evercam.bigredsnapshot; //w w w . j ava2 s . c o m import io.evercam.Camera; import io.evercam.EvercamException; import io.evercam.Snapshot; import java.io.InputStream; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Log; public class SnapshotRequest { public static final String TAG = "bigredsnapshot-SnapshotRequest"; public static Bitmap getExternalSnapshotBit(Camera camera) { Bitmap bitmap = null; try { InputStream inputStream = Camera.getStreamFromUrl(camera.getExternalJpgUrl(), camera.getUsername(), camera.getPassword()); bitmap = BitmapFactory.decodeStream(inputStream); } catch (Exception e) { Log.e(TAG, e.toString()); } return bitmap; } public static Bitmap getInternalSnapshotBit(Camera camera) { Bitmap bitmap = null; try { InputStream inputStream = Camera.getStreamFromUrl(camera.getInternalJpgUrl(), camera.getUsername(), camera.getPassword()); bitmap = BitmapFactory.decodeStream(inputStream); } catch (Exception e) { Log.e(TAG, e.toString()); } return bitmap; } public static Bitmap getSnapshotBitFromEvercam(Camera camera) { Bitmap bitmap = null; try { InputStream inputStream = camera.getSnapshotFromEvercam(); bitmap = BitmapFactory.decodeStream(inputStream); } catch (Exception e) { Log.e(TAG, e.toString()); } return bitmap; } public static Bitmap getLatestSnapshot(Camera camera) throws EvercamException, Exception { Snapshot latestSnapshot = Camera.getLatestArchivedSnapshot(camera.getId(), true); byte[] snapshotByte = latestSnapshot.getData(); Bitmap bitmap = BitmapFactory.decodeByteArray(snapshotByte, 0, snapshotByte.length); return bitmap; } }