forked from github/cordova-android
Changed to use the Camera Intents to our own peril.
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Bitmap.CompressFormat;
|
||||
import android.webkit.WebView;
|
||||
|
||||
|
||||
@@ -21,9 +27,23 @@ public class CameraLauncher {
|
||||
}
|
||||
|
||||
/* Return Base64 Encoded String to Javascript */
|
||||
public void processPicture( String js_out )
|
||||
public void processPicture( Bitmap bitmap )
|
||||
{
|
||||
mAppView.loadUrl("javascript:navigator.camera.win('" + js_out + "');");
|
||||
ByteArrayOutputStream jpeg_data = new ByteArrayOutputStream();
|
||||
try {
|
||||
if (bitmap.compress(CompressFormat.JPEG, quality, jpeg_data))
|
||||
{
|
||||
byte[] code = jpeg_data.toByteArray();
|
||||
byte[] output = Base64.encodeBase64(code);
|
||||
String js_out = new String(output);
|
||||
mAppView.loadUrl("javascript:navigator.camera.win('" + js_out + "');");
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
failPicture("fail");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void failPicture(String err)
|
||||
|
||||
Reference in New Issue
Block a user