Forum > Android

Running Pascal applications in Android

(1/6) > >>

felipemdc:
Hello,

There are two ways to run Pascal apps in Android:
1> As a library connected to Java via JNI
2> As an executable run by the Java app and communicating with it via pipes

Recently I succeeded in using method 2, which is running a simple FPC Pascal application in Android and showing it's WriteLn output in a message dialog:

http://p-tools.svn.sourceforge.net/viewvc/p-tools/PascalNotes4Android/?pathrev=190

Basically you need to rename your app so that it looks like a .so and then upon initialization the Java app needs to copy it to a folder where it can run the application. The folder is returned by getApplicationContext().getFilesDir which points to /data/data/packagename/ and then I use chmod to make the executable runnable.

I don't know how it will fare for apps running for prolonged amounts of time at the moment, some Android developers said it is possible that it won't work.

The Pascal app needs to be compiled separately and placed in the lib/eabi folder. Then after that issue "ant debug" to build the APK installer.

I just thought this might be useful for someone.

bye,

Riccardo Giuliani:
Thank you.
This is an important beginning to understand actual FPC/Lazarus potentialities on Andorid.

felipemdc:
One more milestone achieved:

I managed to build a bridge which exports the Java API and the Android API to Free Pascal. Check this hello world code and screenshot:

http://wiki.lazarus.freepascal.org/Android_Interface/Android_Programming#Using_the_Android_API_from_Pascal

The full code is here:

http://p-tools.svn.sourceforge.net/viewvc/p-tools/PascalNotes4Android/

Leledumbo:
:o Nice work, Felipe. Is there any detailed instruction to compile it? I mean, what SDK required, what's the target platform, etc. I wanna show this my friends (those taking mobile technology classes and programming with NetBeans %)).

herux:
I'm studying this source http://rootserver.rosseaux.net/stuff/BeRoXMAndroidSrc.zip,
use method 1, is not it? What is the best according to you?

Navigation

[0] Message Index

[#] Next page

Go to full version