Android Question Typical cross platform challenges?

Chris Lee

Member
Licensed User
Having completed the android version of my app I'm moving into B4J and have a working prototype.

I've gone heavily down the approach of as much shared code as possible.

Right now I have a working windows prototype in B4J which needs work but the basic functions from the B4A side are in.

I have 808K of shared B4X code, 41.6K B4A only and 76K B4J only.
So basically about 87% shared and 13% device specific.

I don't know if these figures are good or bad, but I am having issues while developing the windows side I break the android side! It's all heavily interlinked code.

I think this approach will pay off in the longer term, and its certainly much quicker building for B4J than B4A because I can reuse most of it. I guess I don't focus on all the code that just worked across platforms from day one.

Interested to hear how others have been dealing with the challenges of cross platform?
 

KMatle

Expert
Licensed User
Longtime User
For me it's about the experience you make. First I did not use services in B4A. Now I put everything non UI related stuff in services. As a benefit this makes it very easy to exchange code between the platforms. I did not measure but 87% is very good. Try that with other platforms like Visual Studio or so
 
Upvote 0

Chris Lee

Member
Licensed User
Hi KMatle, I am curious as to what you mean by 'services' at the moment I'm just sharing cross compatible .bas files between environments using relative paths.

The project is getting quite large and I'm wondering if splitting down into libraries might be beneficial from a compilation standpoint in the main app?
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User

This is the approach I'm using, and I think it works well. Put most of the code in classes, and share the .bas files between environments with absolute paths. In a few spots I use the #If B4A ... Else If B4i ... etc (for example for IME library).
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…