Project

General

Profile

I'm developing a front-end for wifi on Replicant. Need help with SDK

Added by Fil Bergamo over 7 years ago

[ UPDATE: Scripts are now available for a better WiFi management: http://redmine.replicant.us/boards/9/topics/13932 ]

Hi everyone,

I've spent the last few days experimenting on my i9100 with an OTG cable, and this wifi dongle.
I followed these basic instructions with some modifications of mine, and the outcome was quite good.
I tried various use cases, and I reached a usable level of stability by managing how wpa_supplicant, dhcpcd and wpa_cli interact.

I now have almost every piece together to have a full interaction with a wifi AP, including network discovery.
As such, I definitely want to write a simple graphical front-end to the various command line scripts involved in connecting and managing a connection, to make the use of wifi on Replicant as simple as possible for everyone.

I have a robust experience in Java programming, but I never had the opportunity to write an app for Replicant.
I tried to, but the SDK published [[here]] seems out of date, and I can't get to make it work with Eclipse.

As the application I'm willing to write is substantially graphical, the WYSIWYG editor for Eclipse would come in handy, and would speed up my job considerably.
But, as I said, I really can't make it work.
I read Paul's article on the license of Android SDK, and it doesn't seem to give a definitive answer on whether it's free software or not, so for now I'm not willing to use it..

So, I beg for your help and support:
Has anyone succeeded to actually write an application using only the Replicant SDK?
If so, can you please provide some tips and tricks to help make my life easier?
Is it even possible to make the current version of the free SDK work in Eclipse, or is it simply not?

I will consider ANY piece of advice VERY useful, so please, if you know something, don't hesitate to reply.
I'm really optimistic regarding this project, and I can't wait to begin!

(P.S. Obviously, I will release the WiFi front-end under GPLv3.. ça va sans dire!)


Replies (5)

RE: I'm developing a front-end for wifi on Replicant. Need help with SDK - Added by Wolfgang Wiedmeyer about 7 years ago

I'm not familiar with the WYSIWYG editor, so I can't comment on this issue. Regarding building the app, there are different options besides using the Replicant 4.2 SDK:
  • Use the sdk packaged by Debian in Debian Stretch or Unstable. It may not be complete, but it's probably enough for your needs. Unfortunately, my current status is that the packages are not yet available in Trisquel. But you could setup a chroot with Debian that only has the main repository which only contains free software.
  • Build the app with an Android.mk inside the Replicant 6.0 source code. This requires that you download the complete source code of Replicant 6.0 and you will need to get familiar with the build commands. If your app is ready to use, it should be included in Replicant by default and it would be great if it was buildable as part of the Replicant source code. But we can also figure this out when you are more or less finished with the app.
  • Download the SDK the way F-Droid is downloading it: https://gitlab.com/fdroid/fdroidserver/blob/master/makebuildserver#L123
    They use direct download links which don't require to accept the license agreement on the website.

I dislike the third option because it doesn't solve any issues with the licensing, it's just a way to circumvent it. The second options requires some work if you didn't yet interact with an Android build system, but you only need to get familiar with a handful of commands. However, the resulting workflow may be the most inconvenient of the three.
I personally like the first option the most because it's the future. Properly packaging the SDK as part of GNU/Linux distributions is the right way to go. And if you have any issues with it, then you could also help the Debian developers improving the packages.

Again, I'm not familiar with the WYSIWYG editor, so I don't know how much time it really saves. You could also consider to simply combine code snippets from documentation and tutorials to quickly get a UI working. I think that there is in general the possibility that you are reinventing the wheel with the app. So I would definitely look if there is already an app that solves a similar issue. When I was researching the commands that are needed to get the wifi working on Replicant 6.0, I noticed that others had similar issues, but different use cases. The wifi stack in Android is pretty rigid and others already looked into basically the same issues we are trying to solve when they wanted to get multiple interfaces or Ethernet-based interfaces working. So you could search for apps that are for these kind of use cases. Getting reverse tethering working is also a similar issue.
Then you have tasks like handling different ways of authentication, storing network connections and giving users the possibility to edit them. All of these are functionalities that were already implemented multiple times elsewhere. So it's probably worth searching for a library that already does these things for you. It may even be possible to directly access the interface and storage that Android is using for these operations.

RE: I'm developing a front-end for wifi on Replicant. Need help with SDK - Added by Fil Bergamo about 7 years ago

Thanks for replying.

My intention was to just re-use my original scripts (integrated with yours now), and just wrap them in a GUI.
I didn't plan to use the android API to manage WiFi.
So the difficult part is not the business logic (launching a command from Java code is pretty trivial), but the designing of the graphical components.
As for reinventing the wheel: You're right. There is almost certainly some ready-to-use code in some app on F-Droid.
I had a quick look to a couple of them, and it seems that they both use Android's API to manage wifi.
I think it is advisable to do so, even in our case, but I'm not sure if it can work with the external adapter.

Anyway, as I said, coding is not the difficult part here...

I know things can be done with XML and code only, but honestly I don't want to waste any time doing it that way.
My need for help was about making the SDK work with the Eclipse plugin. It should work, according to the SDK wiki page.
But it doesn't.

What I wish I could have, is a comfortable way to write and package the app, without the hassles of having to manually write xml files, manage the app's resources, and everything else not strictly related to business logic.

That's why I asked if someone had some experience in using the SDK.. to see if someone else had solved the issue of the Eclipse plugin not working as it should.
But I guess that there are no app developers around here in the forum, only system developers or plain users...
As the issue is strictly related to the Replicant version of the SDK, it makes no sense to try and ask on other forums.
..so.. I'm very pessimistic on this.

Thank you anyway for your reply!

Fil

RE: I'm developing a front-end for wifi on Replicant. Need help with SDK - Added by Fil Bergamo about 7 years ago

Hi,

a quick update, just to inform everyone that I finally decided to go the hard way, and actually started developing the graphical app for the use of libre wifi on Replicant.
I successfully installed Replicant's SDK.
I just had some issues with the ADT package linked in the wiki (version 20).
Eclipse was complaining that ADT's version was too old to be used with API 17 (which is the one Replicant's SDK targets).
So I just downloaded ADT version 21.1.0, manually substituting the version number in the link provided in the wiki.

If anyone with wiki access is reading this, I suggest updating the link to google's ADT package in this page, from version 20.0.0 to version 21.1.0.

Now the whole thing works enough to let me do the job without much pain..
Only the WYSIWYG editor doesn't seem to be working at all.
So I decided to give up on comfort a little bit, and started designing the GUI with plain XML. Not very funny, but it works.

Right now I have a usable front-end, with clickable buttons to scan and connect to networks.
I just need to work a little more on the engine to solve some issues.

I hope I will be able to release an alpha version of the app in 10-15 days..
It will support both Replicant 4.2 and 6.0, automatically detecting the build version on which it's running.

Stay tuned and, as always, Happy Hacking to everyone!

Fil

RE: I'm developing a front-end for wifi on Replicant. Need help with SDK - Added by Wolfgang Wiedmeyer about 7 years ago

Fil Bergamo wrote:

I successfully installed Replicant's SDK.
I just had some issues with the ADT package linked in the wiki (version 20).
Eclipse was complaining that ADT's version was too old to be used with API 17 (which is the one Replicant's SDK targets).
So I just downloaded ADT version 21.1.0, manually substituting the version number in the link provided in the wiki.

If anyone with wiki access is reading this, I suggest updating the link to google's ADT package in this page, from version 20.0.0 to version 21.1.0.

I gave you wiki access so you can do the changes yourself. You'd need wiki access anyway at some point to document the dongle usage.

Now the whole thing works enough to let me do the job without much pain..
Only the WYSIWYG editor doesn't seem to be working at all.
So I decided to give up on comfort a little bit, and started designing the GUI with plain XML. Not very funny, but it works.

That's why I suggested using the SDK packaged in Debian. It targets the same API as Replicant 6.0 and it may work with the Eclipse plugin.

Right now I have a usable front-end, with clickable buttons to scan and connect to networks.
I just need to work a little more on the engine to solve some issues.

I hope I will be able to release an alpha version of the app in 10-15 days..
It will support both Replicant 4.2 and 6.0, automatically detecting the build version on which it's running.

This is great news! I'm happy to hear that you are making progress!

RE: I'm developing a front-end for wifi on Replicant. Need help with SDK - Added by Fil Lupin over 6 years ago

Hi Fil, I wondered if you've advanced in your project?
It will sure interest people :)

    (1-5/5)