Android extensions using common API - what parts work?

J Jon Tara 3 years 6 months ago
25 3 0

It's apparent that Android extensions using common API are pretty broken. I'd appreciate any candid assessment of what parts we can expect to work, and what parts we shouldn't bother with.

I'm closing-in on at least part of it.

The generated code SEEMS to deal with property bag properties, but something is broken, and it just plain doesn't work.

Digging into the Rhodes source code, there aren't any complete, WORKING Android common API modules that use generated code for handling Android property-bag properties. There seem to be several partial/abandoned/unimplemented APIs in the source code, where it appears the author was having the same kind of struggles that I am having.

Where extensions do have a common API with property-bag properties implemented and working, the generated code was not used. The base code has been "collapsed" into the implementation. It is apparent from the source code that setting default property values in the XML file does not work, since there is code in working APIs that sets default values explicitly in code. For iOS, the generated code takes care of this.

For example, from AudioCapture.java:

        if(mActualPropertyMap.size()==0)
        {
            mActualPropertyMap.put("maxDuration", "20000");
                                   
            //mActualPropertyMap.put("fileName", "AudioCapture");
            mActualPropertyMap.put("fileName", "");
            mActualPropertyMap.put("encoder","AAC");
            mActualPropertyMap.put("source", "mic");
        }

So, you can see that default property values are being set explicitly here in code, and default values in the XML will be ignored then.

I think AudioCapture (5.0.30) is the closest thing we have to a working common API with properties that can be used as an example. But it will be painful, because that code doesn't use the generated base classes.

Can a Rhodes developer jump in here and tell us what we can expect to work, and what we shouldn't waste our time on?

Thanks.

Please Register or Login to post a reply

3 Replies

J Jon Tara

iOS generated common API extension code initializes properties using default values from XML.

Android doesn't.

See workaround here:

CommonAPI Extensions (Android) PropertyBag Properties are not initialized · Issue #309 · rhomobile/rhomobile-docs · GitH…

J Jon Tara

Android Common API extensions - propertyBag apparently not support · Issue #600 · rhomobile/rhodes · GitHub

CommonAPI Extensions (Android) PropertyBag not supported? · Issue #309 · rhomobile/rhomobile-docs · GitHub

J Jon Tara

BTW, the "id" property is missing from AudioCapture. So, it's been hand-coded to "work", but still isn't quite right.

I DO get the default properties when I call getAllProperties():

I/APP     (14088): I 04/29/2015 19:33:10:127 00003732       AppApplication| Rho::BonjourBrowser.calcSumm(2,4) = 6
I/APP     (14088): I 04/29/2015 19:33:10:127 00003732       AppApplication| Rho::BonjourBrowser.search = 123
I/APP     (14088): I 04/29/2015 19:33:10:128 00003732       AppApplication| BonjourBrowser properties: {"id"=>"default"}
I/APP     (14088): I 04/29/2015 19:33:10:129 00003732       AppApplication| AudioCapture properties: {"fileName"=>"", "source"=>"mic", "maxDuration"=>"20000", "encoder"=>"AAC"}

Assumption here is that the generated code/template is broken.

There clearly is code that that SHOULD enumerate/access properties. Perhaps they just are not being initialized from the XML. Will do some experiments, trying to set properties.

CONTACT
Can’t find what you’re looking for?