android externals

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

Locked
monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: android externals

Post by monte » Tue Jul 23, 2013 11:51 am

;-)

I thought you'd say that. What about a class between Activity and LiveCodeActivity?
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: android externals

Post by LCMark » Thu Jul 25, 2013 9:30 am

@monte: Or, how about an interface... We can define an interface which the engine class implements and then in the Support.java file, the LC class can import that and use it to provide the API calls which don't need any interaction with the core (C++) engine. This has the advantage of keeping the clean separation between external (module) and core. i.e. All API calls will still be vectored through the 'LC' class, but it can directly use Java to provide the functionality rather than the rather tortuous root of going through the JNI twice (once into C++, and then once out into Java).

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: android externals

Post by monte » Thu Jul 25, 2013 11:33 am

@runrevmark Ok. com.runrev.android.ExternalInterface? And you want to implement it on Engine? I can do this if you want.

BTW is there any chance that the engine changes for this stuff could be merged into 6.1.1? Then I can start getting a few eternals out.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: android externals

Post by LCMark » Thu Jul 25, 2013 2:07 pm

@runrevmark Ok. com.runrev.android.ExternalInterface? And you want to implement it on Engine? I can do this if you want.
Done - at least an initial version. There's now an 'EngineApi' interface which is still 'private' (like the externalsv1 interface is), but exposed to the LC support class where it's used to implement the functionality. There's a 'LC.ActivityRun' method which runs (in a blocking fashion) an activity and then calls a callback when done. (As it 'waits' ActivityRun must be called from the script thread).

I've also implemented the 'LC.Wait' class and 'LC.RunOnSystemThread' primitives which should hopefully help with a good deal of other Android UI interactions.

There are examples of both things as new buttons in the 'revtestexternal.livecode' stack and in 'revtestexternal'.
BTW is there any chance that the engine changes for this stuff could be merged into 6.1.1? Then I can start getting a few eternals out.
I shall see what I can do...

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: android externals

Post by LCMark » Thu Jul 25, 2013 2:33 pm

yes it does resolve the quirky syntax on a few counts (java prefix, c parameters)
I started working on the lcidl syntax changes and such to support the general types and extended 'use' parameter the other day as well - needs a bit more work until its suitable to commit, but its getting there.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: android externals

Post by monte » Thu Jul 25, 2013 9:42 pm

Great, this is much better than multiple JNI calls. I'm not sure if there's a use case for starting an activity in a non-blocking way. I guess if we come up with one we can work it out...

A few things I noticed:
- I think declaring interface methods abstract and possibly even public is redundant
- We are declaring ActivityResultCallback twice in LC and in EngineAPI
- Should com.runrev.android.EngineAPI be pumped out next to LC.java?
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: android externals

Post by LCMark » Fri Jul 26, 2013 1:46 pm

I think declaring interface methods abstract and possibly even public is redundant
Apparantly so...
We are declaring ActivityResultCallback twice in LC and in EngineAPI
Yes - this is for consistent naming (then everything is LC.) and also because EngineAPI interface is private from the point of view of externals. The public interface that externals have access to in Java is the LC class. Just like the LC API calls in native code, these use the private externalv1 interface to provide functionality that may not be the same and may be augmented.
Should com.runrev.android.EngineAPI be pumped out next to LC.java?
No - for the reasons given above.

Eventually, there will be a public interface on both the Java side and native side which is a direct interface on the engine - but we're not at a point that's appropriate to 'fix' that, so the private interface with wrappers is the way things need to be for now.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: android externals

Post by monte » Fri Jul 26, 2013 9:00 pm

OK, I'm trying to play with this but I've getting an error from the standalone builder. I've built the android engine, built and run the IDE all debug mode, built my external, chosen my device then clicking test gets me "could not encode class bundle"... it's fine if I don't include my external. Any ideas?
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: android externals

Post by monte » Fri Jul 26, 2013 10:13 pm

Never mind.. had to add the engine jar
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: android externals

Post by monte » Fri Jul 26, 2013 11:00 pm

Whoop... mergZXingGetBarcode!!!!
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

vikkysingh
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 16
Joined: Fri Dec 31, 2010 8:13 am

Re: android externals

Post by vikkysingh » Sat Jul 27, 2013 11:46 am

monte wrote:Whoop... mergZXingGetBarcode!!!!


hope the other extnl's are not too far behind

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: android externals

Post by Mag » Sat Jul 27, 2013 1:44 pm

monte wrote:Whoop... mergZXingGetBarcode!!!!
WOW!

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: android externals

Post by monte » Sat Jul 27, 2013 10:37 pm

hope the other extnl's are not too far behind
It will take a while to get where I am on iOS on Android. As we work out the SDK I'm implementing some things but most of mergExt will need to wait for people to fund it.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: android externals

Post by monte » Sun Aug 04, 2013 1:45 am

Platform specific enum values might be nice...

Code: Select all

enum some-enum
     "hello" as 0
     "world" as 1
     "earth" as 1 on Android
     "mars" as 1 on iOS,OS X
Here on Android "earth" is 1, on iOS and OS X "mars" is 1 and on all other platforms "world" is 1. Appropriate errors would be thrown if the wrong parameter was sent for the wrong platform.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: android externals

Post by LCMark » Wed Aug 07, 2013 11:56 am

BTW is there any chance that the engine changes for this stuff could be merged into 6.1.1? Then I can start getting a few eternals out.
I committed the engine-side changes from my externals-api-v5 branch into release-6.1.1 this morning so externals built using stuff from feature-externals_api_v5 in my repo should load and work with 6.1.1-rc-2 and onward :)
Here on Android "earth" is 1, on iOS and OS X "mars" is 1 and on all other platforms "world" is 1. Appropriate errors would be thrown if the wrong parameter was sent for the wrong platform.
That's a neat idea.

On a related note, I've got a fair bit further with the syntax changes and restructuring needed for we've previously discussed, indeed, I merged the 'syntax_changes' branch into feature-externals_api_v5 the other day and things seems to be working okay. In the process I cleaned up the lcidlc code generation a little - particularly the type-mapping stuff - and also made it so that Java implementations are called directly from the 'variant_' functions, rather than calling a shim.

Locked

Return to “Engine Contributors”