#1 2020-04-27 18:58:40

AOG
Member
Registered: 2014-02-24
Posts: 490

The mORMot on Android

For anybody interested in running the mORMot on your Android phone.

https://github.com/LongDirtyAnimAlf/fpc … -debug.apk

This is TestSQL3 designed to run on Android through OpenGLES.
Its for armv7, so should run on any phone.
Enjoy. Feedback welcome as ever.

Offline

#2 2020-04-27 19:56:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,546
Website

Re: The mORMot on Android

It worked great on my cheap (50€) phone!

Only issue is that some tests failed...
Did all tests pass on yours?

Offline

#3 2020-04-27 20:16:27

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

On my phone, I have 76 failures. Of which 74 similar from one test.

Last edited by AOG (2020-04-27 20:16:48)

Offline

#4 2020-04-28 06:50:42

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

Solved the remaining issues.
New uploaded (see link) apk now gives all greens on my phone.

Edit:
This apk was created with FPC (and Lazarus). Not a single line of java was needed. Its a pure native Android app, written in Pascal.

Last edited by AOG (2020-04-28 06:53:02)

Offline

#5 2020-04-28 09:25:10

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

Uploaded universal apk. It has armv7 and arm64. This is needed for the app-store.

https://github.com/LongDirtyAnimAlf/fpc … -debug.apk

Offline

#6 2020-04-28 11:14:54

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: The mORMot on Android

all tests passed !!! Congratulations AOG !!!

Can you suggest me tutorials for Android development with Lazarus/FPC ? I know that there is someones in the net, but I don't know the more reliable.

Thanks.


Esteban

Offline

#7 2020-04-28 13:09:25

camu72
Member
From: Salta - Argentina
Registered: 2015-07-12
Posts: 28

Re: The mORMot on Android

Very Cool!!! All test passed ... and like Esteban, I would also appreciate a reference to a tutorial ... Congratulations AOG!

Offline

#8 2020-04-28 14:38:37

urhen
Member
Registered: 2020-02-13
Posts: 36

Re: The mORMot on Android

iOS also fully functional?

Offline

#9 2020-04-28 18:26:51

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

I am a bit busy the next couple of days. But I will publish all.
In general, the LAMW framework can be used to make Android apps based on Java.
The Castle Game Engine can be used for iOS apps.
For this test however, I have used the Asphyre PXL framework.
Will update on its use.

Last edited by AOG (2020-04-28 18:28:25)

Offline

#10 2020-05-03 07:33:43

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

Sources are uploaded. They contain a special version of the mORMot.

https://github.com/LongDirtyAnimAlf/AsphyrePXL

Tha latest (pre-) release of fpcupdeluxe can install these sources AND perform some magic to set all path correct.

https://github.com/LongDirtyAnimAlf/fpc … tag/1.6.8o

Edit:
The module name to install/use is "mORMotPXL".

Last edited by AOG (2020-05-03 07:51:49)

Offline

#11 2020-05-03 15:21:53

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: The mORMot on Android

Thank you @AOG !!! I'll investigate. One question: is needed asphyre for non graphical apps ?


Esteban

Offline

#12 2020-05-03 16:33:19

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

This is a pure Pascal native Android app. No Java, so no easy views. That is why I used Asphyre and GLES.
With normal Java, you can create views and more easily.
But for testing, this was the most easy way to do.
For all the rest, I would advice LAMW.

Offline

#13 2020-05-03 16:50:30

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 337

Re: The mORMot on Android

Ok, thank you very much.


Esteban

Offline

#14 2020-05-03 19:00:42

emk
Member
Registered: 2013-10-24
Posts: 96

Re: The mORMot on Android

AOG wrote:

This is a pure Pascal native Android app.

Can I use sqlite-db-acces from mORMot as Android-library(.so, .a) or iOS .dylib linked to FMX project?
For example a subset of main database will be downloaded from server to local device to speed up things, so the most used tabled are in place and acts as a cache.
I can use the same code(partially) on the main server and also on the local device - FMX (views) and shared library (data access and logic).

Offline

#15 2020-05-04 06:38:35

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,546
Website

Re: The mORMot on Android

FMX is supported only for the client side (SynCrossPlatform* units), not the server/data side (SynCommons/mORMot/SynSQLite3).
So a FMX project won't be able to use the mORMot SQlite3 features.

Whereas with FPC, it will work, as the Alfred sample shows.

Offline

#16 2020-05-04 12:26:53

emk
Member
Registered: 2013-10-24
Posts: 96

Re: The mORMot on Android

ab wrote:

FMX is supported only for the client side (SynCrossPlatform* units), not the server/data side (SynCommons/mORMot/SynSQLite3).
So a FMX project won't be able to use the mORMot SQlite3 features.

Whereas with FPC, it will work, as the Alfred sample shows.

That's what I wanted to say: mORMot+FPC packed in shared library. This library can be used by a FMX project.

Last edited by emk (2020-05-04 12:27:46)

Offline

#17 2020-05-04 13:10:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,546
Website

Re: The mORMot on Android

@emk
Ah! Make sense now!
smile

I guess we may more easily add Delphi new targets in mORMot2.
In plain mORMot, it could be difficult to add Delphi iOS, Android or Linux support.
But in mORMot2, all Operating System calls are defined in a single unit named https://github.com/synopse/mORMot2/blob … ore.os.pas
So we may be able to add Delphi multi-target support easier.

Offline

#18 2020-05-04 13:43:20

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

Hi Ab,
I was looking at the mORMot2 code you posted above.
Regarding mORMot and testing on different platform, I would like to ask you a favor.

To get TestSQL3 running on Android, I needed to catch the output to console (STD).
Normally, Android has no (visible) console.
In mORMot1, TestSQL3, you use a text to write towards console.
I would like to ask you to make this a variable (global or setable) text to be able to catch it. Can be a file, can be a stringlist-redirect like I have used for the Android sample. That way, mORMot2 can put its TestSQL3 output (or other console output) in any text, being std by default.
Thanks, Alfred.

Offline

#19 2020-05-04 15:34:54

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,546
Website

Re: The mORMot on Android

@Alfred

I have added such a callback to mORMot2.
smile

Offline

#20 2020-05-04 16:12:20

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

That is good ! Thank you !!

Offline

#21 2020-05-04 17:03:01

emk
Member
Registered: 2013-10-24
Posts: 96

Re: The mORMot on Android

ab wrote:

Ah! Make sense now!

mORMot+FPC can act as fast "local server" ("so" library or "dylib") on mobile device. The first use case I wait to test sqlite-access+custom-AES-encryption.
Exchange of data between FMX-project and "local server"  can be made as JSON. Practically you can have on your mobile a replica(subset or integrally) of the main database from cloud-server but sharing the same code (AES, pascal stored procedures, etc)

ab wrote:

I guess we may more easily add Delphi new targets in mORMot2.

Perfect! Because I see a real push from ARM servers.

Last edited by emk (2020-05-04 17:05:17)

Offline

#22 2020-05-04 17:26:40

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

@emk.
This issue has been discussed more often on this list: the need for offline (but encrypted) functionality on mobile.
I would be very interested in an automagical (user transparent) scheme to have offline changes uploaded to online and an auto-switch-over from off- to on- to off- with updates and encrypted local storage.

Offline

#23 2020-05-13 10:52:50

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: The mORMot on Android

Interesting work.

i would like to test it on RS 10.4 do you think it will work ?

Last edited by itSDS (2020-05-13 10:54:44)


Rad Studio 12.1 Santorini

Offline

#24 2020-05-13 11:29:32

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: The mORMot on Android

https://www.google.com/search?q=RS+10.4

What is RS 10.4 ... |-) ... ?

Offline

#25 2020-05-13 12:14:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,546
Website

Re: The mORMot on Android

RS 10.4 = Rad Studio 10.4 = upcoming Delphi 10.4.

And to answer the question.
It won't work with Delphi Android. Only FPC Android is supported for server side.
But you can generate client code for Delphi Android, even in older revisions.

Offline

Board footer

Powered by FluxBB