Git Product home page Git Product logo

Comments (2)

dpa99c avatar dpa99c commented on July 20, 2024

This example plugin only demonstrates primitive types such as int and string.
I'm unsure if the Android JNI supports passing of complex types but that is beyond the scope of this simple example.
For iOS it's easier as you only have to map the stringified Javascript structure passed via the Cordova plugin interface to C types in your Objective C plugin implementation.
I'd suggest Googling how to pass complex types using the Android JNI as this is not something I've had need to do so have no experience with.

from cordova-plugin-hello-c.

exonent avatar exonent commented on July 20, 2024

Android is over for this project. iOS is the main.

My problem is when Objective try to read a Struct from JS.


- (void) calc_example:(CDVInvokedUrlCommand *)command
{

    // option 1 - NSString* a = [[command arguments] objectAtIndex:0];
    // option 2 - NSArray* a = [[command arguments] objectAtIndex:0];
    // option 3 - NSDictionary* a = [[command arguments] objectAtIndex:0];
    // More options?

    float output = calc_example(a);
    
    CDVPluginResult* result = [CDVPluginResult
                               resultWithStatus:CDVCommandStatus_OK
                               messageAsDouble:output];

    
    [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}


from cordova-plugin-hello-c.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.