android externals

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

SamanthaLC
Posts: 22
Joined: Sat Jul 20, 2013 11:57 pm

Re: android externals

Post by SamanthaLC » Thu Sep 26, 2013 6:21 am

Hello monte,

Thank you for your input. I do indeed need to call into a third party library for distinct user session tracking. They handle this using the intents mentioned above, but they are not part of any of my stacks. I would like to be able to use this third party session and analytics platform in my LiveCode Android app but it needs to be "included" in the build like a native external, but at the same time not really an external.

In LiveCode I communicate with this service via JSON HTTP requests, which is fine. But the bootstrap / library hooks need to be included in the package and registered in the Manifest.

I hope this makes sense. I can explain further if needed.

Thank you for the pointers to the runrevmark repos on GitHub, I am looking at these now however they seem to be community edition only. Do you know if the community builds of the engine and externals are compatible with the paid version?

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 Sep 26, 2013 1:07 pm

@SamanthaLC most of the changes in that branch are just in the lcidl compiler. @runrevmark merged in the engine changes into the engine in 6.1.1 so they work in both commercial and community versions.

I think at the moment you might need to make yourself a little tool that unzipped the apk, place the library correctly, zip it back up and sign it etc. There's an off chance that you could just add it in a a libs relative path in the copy files section of the standalone builder and it will work.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

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

Re: android externals

Post by LCMark » Mon Sep 30, 2013 10:09 am

@SamanthaLC: From a brief look at the example you provided above, this looks like something that needs to be added to the standalone builder. (I'm assuming here that no Java code is needed to register the intent or classes, just the entry in the manifest). There are a couple of options here...

The first would be to make the standalone builder compile any 'jar' files included in the copy files pane in the Classes jar it creates for the application. This would then, additionally, require a method to provide the clauses to the manifest for the services the jar files provide.

The second would be to extend the externals mechanism a bit. Add the ability to include third-party jar files within the external zip along with a fragment of XML containing the clauses that should be added to the manifest at build time.

The latter means the service classes and manifest additions would be self-contained... The former wouldn't require creating the appropriately formatted lcext zip beforehand (but would require per-app configuration).

If Java code is required to be executed, then that would need an external (unless the processing is uniform, in which case we can implement a general handler) - however, as things stand this would still require the standalone builder to be updated to accept a manifest fragment to be included at build time from an lcext zip.

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 » Mon Sep 30, 2013 11:18 am

Yeah... sorry, I was way off with my idea. I like the first idea combined with custom manifest templates... would like custom plist templates for iOS too...
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

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

Re: android externals

Post by LCMark » Mon Sep 30, 2013 1:20 pm

Yeah... sorry, I was way off with my idea. I like the first idea combined with custom manifest templates... would like custom plist templates for iOS too...
Looking back at your comments, does this require some sort of general abstraction around invoking intents and such? Are there any simple examples floating around (in Java) of the kind of situation @SamanthaLC was asking about?

After all, declaring a service in the manifest isn't going to be much use unless it can be invoked from within LiveCode itself...

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 » Mon Sep 30, 2013 10:29 pm

Looking back at your comments, does this require some sort of general abstraction around invoking intents and such? Are there any simple examples floating around (in Java) of the kind of situation @SamanthaLC was asking about?
We could certainly do a general abstraction for a broadcast receiver. I was thinking of doing this as a functional equivalent of mergNotify which is a NotificationCenter external. However, because we don't have the general notification type LCObjectPost (dispatching to this card of this stack) if you declared the receiver in the manifest rather than calling a command there would be no way to get an object reference to post to. But I don't think @SamanthaLC wants anything like that. It sounds like there's a receiver in the jar and it's just a matter of compiling the jar with LC and then adding the full class name as a reciever in the manifest. LiveCode itself wouldn't know what's going on.
After all, declaring a service in the manifest isn't going to be much use unless it can be invoked from within LiveCode itself...
Isn't the point of declaring it in the manifest that the OS invokes them?
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

SamanthaLC
Posts: 22
Joined: Sat Jul 20, 2013 11:57 pm

Re: android externals

Post by SamanthaLC » Wed Oct 02, 2013 8:14 pm

runrevmark wrote:There are a couple of options here...

The first would be to make the standalone builder compile any 'jar' files included in the copy files pane in the Classes jar it creates for the application. This would then, additionally, require a method to provide the clauses to the manifest for the services the jar files provide.
Hello Mark,

Thank you for your reply! The method you describe above, passing in the third party Jar via copy files, and providing a new "manifest includes" input for the stand alone builder to combine into the built package, would work perfectly for my needs discussed above.

I am still working through the dependencies for building the community edition engine and UI from your GitHub repos. It is slow going as there seem to be many assumptions and dependencies associated with building from sources on OSX. Has anyone provided a nice walk through explaining how to install the dependencies and build from source, end-to-end?

Thank you again for your assistance, I do appreciate it!

SamanthaLC
Posts: 22
Joined: Sat Jul 20, 2013 11:57 pm

Re: android externals

Post by SamanthaLC » Wed Oct 02, 2013 8:19 pm

runrevmark wrote: ... If Java code is required to be executed, then that would need an external...
Hi Mark,

Externals seem to support everything I need for integrating my scripts with third party libraries.

The one exception is the helper commands that don't appear to work on Android. I posted about this in the other thread http://forums.runrev.com/viewtopic.php?f=66&t=17258 "Listing Android externals, commands and function in LiveCode"

Thanks again!

SamanthaLC
Posts: 22
Joined: Sat Jul 20, 2013 11:57 pm

Re: android externals

Post by SamanthaLC » Wed Oct 02, 2013 8:37 pm

monte wrote:But I don't think @SamanthaLC wants anything like that. It sounds like there's a receiver in the jar and it's just a matter of compiling the jar with LC and then adding the full class name as a reciever in the manifest. LiveCode itself wouldn't know what's going on.
Hi Monte,

You are correct. LiveCode does not need to know about the third party session tracking component that is simply "triggered" via the Manifest for the desired intents. I communicate with the analytics service via HTTP and XML which works fine in LiveCode. It is just the integration into the package, and hooking up this third party code to the desired intents in the Manifest, that is causing me trouble.

Thanks again!

SteveTX
Posts: 170
Joined: Sun Jan 17, 2010 9:00 pm

Re: android externals

Post by SteveTX » Wed Oct 02, 2013 8:38 pm

It would be so awesome to finally be able to use external externals with livecode. Please code this in ASAP Mark!

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 Nov 01, 2013 7:09 am

We will need an equivalent of LCInterfaceQueryViewScale for android in 6.5. I'm looking into 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 » Fri Nov 01, 2013 7:42 am

What about a way to get the stack view's affine transform? That way if it's a stretched mode we the native views can stretch too.
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 Nov 01, 2013 9:59 pm

OK so here's the changes to support LCInterfaceQueryViewScale() cross platform:
https://github.com/runrev/livecode/pull/347

And to support LC.InterfaceQueryViewScale() on android:
https://github.com/runrevmark/livecode/pull/6

I haven't worried just yet about adding a way to get the affine transformation of the stack but I think it's going to need to happen if people use stretched views. At the moment it looks like the engine's native controls don't handle this either.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

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

Re: android externals

Post by LCMark » Wed Nov 06, 2013 8:36 pm

What about a way to get the stack view's affine transform? That way if it's a stretched mode we the native views can stretch too.
Perhaps a 'better' way of handling this would be to have the engine set the transform of the container view for native views - although I've not yet looked into whether that would actually work yet ;)

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 » Wed Nov 06, 2013 10:55 pm

Well... that would be helpful. Once that happens LCInterfaceQueryViewScale should just return 1 for backwards compatibility... and I just realised that my LCInterfaceQueryViewScale change isn't backwards compatible... It should always return 1 on iOS now unless the user as specifically requested to use the full resolution. While on Android it needs to return the stack scale.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Locked

Return to “Engine Contributors”