arsd.jni

jni my.email at gmail.com
Sun Dec 11 05:09:29 UTC 2022


On Saturday, 10 December 2022 at 22:53:14 UTC, jni wrote:
> Friends, I have decided to use D lang to link with the Android 
> NDK. I can make an app that can use the android platform's 
> functions and the android site says they are available in C for 
> linux and windows! Making apps in android studio or 2 other 
> programs I have used before is easy but now I require D because 
> of the advantages  quality innovations I have written inside a 
> D library, second I would use the D std library for using curl, 
> and it needs to be in an apk for now and maybe in the years to 
> come I will switch to using a binary executable. As you can 
> see, linking with the NDK from D is the one possible outcome.
>
> I have succesfully linked with the NDK and learned valuable 
> linux programming along the way, but before I get too 
> over-enthusiastic and joyous and get ahead of myself to make an 
> error in trying to use the optional Android Studio together 
> with  the arsd.jni, please, I wish to share with you my 
> questions and concerns for the best way to move forward with 
> this massive undertaking this thing, and how to go about 
> calling android platform functions using arsd.jni and other D 
> lang technologies from code.Dlang.org that may be useful to me.
>
> For starters I wish to call the wifi functions for checking 
> internet availability. How can I achieve this most efficiently? 
> Then there are the maven questions because Android Studio does 
> many of these automatically, and from my experience does an 
> annoyingly gross job at it, btw unless you use all of their 
> official tools. How do I use the maven for using jars or an 
> Apache repository for server communication? I am using gradle 
> with all this and everything works fine. Any suggestions on how 
> to start this thing is welcome. I will connect through SSL with 
> a remote server and print a log on the server side. On the 
> Android side only connect and wait for further data to be 
> recieved and if the stream finishes then it should stop the 
> app. That part will mean sleeping the app until when it is 
> relaunched. The server is php code.
>
> I tried to add in correct place on forums. Thank you.



Friends I am troubling you with too simple of a message. Please 
allow me to not be dissapointing myself here.

Friends, mainly the focus of this very simple project is I will 
try to use the Android NDK "framework" API, as it is called, once 
I have linked succesfully, as I have already tested, next all 
that is left is to use the Android platform's NDK API from D lang 
code because I am trying my best not to use Java. I was wanting 
to include the JNI for good measure but was already planning to 
use the NDK API with extern(C). I thought it would be 
straight-forward since I knew that the Android platform used jni 
in the OS, but after doing some digging all I could find was the 
API reference over on android.com. There isn't much complication 
to be done only I was catching myself guessing how to go about it 
most efficiently for such a simple and small project. I would try 
to call the NDK API functions since it is the most low-level and 
C-like functional programming. I know much less of Java and will 
try to write the minimum I can.

What I need is D lang because I have a D module to include into 
the app, there may be code.dlang.org packages that I may want to 
use, I will be using the std lib curl functions, there is the 
possibility of having to include functions from a seperate C 
library in the future if all goes well, the need to use maven for 
an Apache project's client and adding 2 other jars for it that 
are personal libraries, the possibility of using Android Studio 
if things get rocky. As you see there is no other way. I must use 
D or find something else to do.

A small project as this that I would like only simplicity, any 
recommendations or suggestions on how would be the best way to go 
through with this?


More information about the Digitalmars-d-learn mailing list