Tuesday, April 10, 2018

How can i send data from Java Script to gwt Coding using JsInerop.

Here it is ...!

-->I am calling cordova implementation from this coding. 

//Handles imageCapture icon 
final Image cameraIcon = new Image(ImageNameConstants.CAMERA);
cameraIcon.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (!isReadOnly() && isEditable()){
if (ClientSettings.isMobileNative()){
     imageData = imageCapture(); //This  might wrong iam not getting data.
FileContent fileContent = new FileContent();
if (imageData != null){
    FileRPCServiceAsync cameraRpc = ServiceFactory.getService(FileRPCService.class, FileContent.class);
new BaseAsyncCallback<FileContent>(messagePresenter) {
public void handleSuccess(FileContent file) {
public boolean handleException(Throwable caught) {
Log.error("Error in saving file status:"
+ ErrorMessageHandler.stringify(caught));
return true;

                     private  native  String imageCapture()/*-{
if ($wnd.isImageSupported()){
return $wnd.imageCapture();
//var imageCaptureWidget = $doc.getElementById();

-->This my JS code.

function isImageSupported(){
var supported = true;
return supported;
function imageCapture(){
try {
        navigator.camera.getPicture(onSuccess, onFail, {
        quality: 50,
        destinationType: Camera.DestinationType.DATA_URL,
        sourceType: Camera.PictureSourceType.CAMERA
    function onSuccess(imageData) {
        return imageData;

    function onFail(message) {
        alert('Failed because: ' + message);
} catch(e){
alert("CAPTURE-ERROR-Works On Mobile Devices Only.");

please some one help me after taking image i need that base64 string in js to  java async call, how to achieve this by using jsInterop.

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment