开发者

Signature Capture in PhoneGap Android Application

开发者 https://www.devze.com 2023-02-03 10:21 出处:网络
I am trying to use this 3rd Party Signature Capture Android Application with my PhoneGap Application. I have no idea how to \"Call the right Activity\" from my PhoneGap App. My Application is written

I am trying to use this 3rd Party Signature Capture Android Application with my PhoneGap Application. I have no idea how to "Call the right Activity" from my PhoneGap App. My Application is written in html and javascript.

Please help!

I have installed the application on my Droid X and it Captures my Signature with my finger. Its super smooth and quick.

http://www.binarysolutions.biz/

Here are the instructions from their website. They are not very detailed.

String key      = ""; // set the key, any string you find suitable
String fileName = ""; // set the file name (global write permissions)

Intent intent = new Intent("biz.binarysolutions.signature.CAPTURE");

intent.putExtra开发者_StackOverflow社区(key, fileName);
intent.setComponent(
    new ComponentName(
        "biz.binarysolutions.signature",
        "biz.binarysolutions.signature.Capture"
    )
);

startActivityForResult(intent, CAPTURE_REQUEST_CODE);
Receiving the result

@Override
protected void onActivityResult
    (
         int    requestCode, 
         int    resultCode, 
         Intent data
    ) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == CAPTURE_REQUEST_CODE && 
        resultCode  == RESULT_OK) {

        String fileName = ""; // the same file name as above
        Bitmap bitmap   = BitmapFactory.decodeFile(fileName);

        // do with bitmap whatever you like
    }
}


The integration of the signature application is doable via an Android Intent to invoke the signature app. Looks like you have the instructions for what you need to do on the Java (native) side to integrate with the signature application, but you are at a loss to do so inside a PhoneGap Android app.

Take a look at WebIntent. It is a PhoneGap Android plug-in - this is an extension to the PhoneGap API and is composed of a small JavaScript interface which your PhoneGap app uses, and a native (Java) component that the JS interface talks to. The WebIntent blog post linked above actually does a pretty good job of explaining a PhoneGap plug-in, too.

What you'll have to do on top of integrating the WebIntent plug-in is interfacing the WebIntent with the Signature app - so the intents getting passed around on the native side contain the proper parameters.


Starting from version 2.5 Signature Capture library can be started from the web browser just by clicking on a specific link. It can also 'upload' captured image to given url. Check out the instructions here:

http://www.binarysolutions.biz/2010/12/signature-capture-for-android.html#usage_web

Hope that could help.

0

精彩评论

暂无评论...
验证码 换一张
取 消