Tag Archives: fdroid

Customising F-Droid client (Android repo)

This is part 2 of a 2 part series about rolling out your own “Play Store” based on F-Droid for Android devices.

Server set up instructions can be found at http://paulscott.co.za/blog/setting-up-a-private-android-appstore-with-fdroid/

The first thing that we need to do, is to get hold of the source for the client at gitorius.

Do a git clone of the code with

git clone https://git.gitorious.org/f-droid/fdroidclient.git fdroid-client

which will give you a checkout in the fdroid-client directory.
Directly afetr the checkout completes, cd into your new fdroid-client directory and grab the git submodules with:

git submodule update --init

and then we need to prepare for our ant biulds with:

./ant-prepare.sh # This runs 'android update' on the libs and the main project
ant clean release

Which will then build the stock release version of the client. Now, the point here is to do some customising right? OK, so let’s start with that then…

The first step here is to make sure that you can install your new package manager client alongside FDroid client too. In order to do this, edit tools/change-package-name.sh and change the parameters that you need to (package name and identifier)

FDROID_NAME=${2:-Your FDroid}

Change these values to something closer to what you want i.e.

FDROID_NAME=${2:-Pauls FDroid Client}

Execute the package name changer script and get yourself a cookie for getting this far!

Now would be a good tme to import the code into an IDE like Eclipse or Android Studio. Note, however, that due to the way this project is built and laid out, it will probably not compile, and Eclipse will moan about it. No matter though, you are only modifying code in Eclipse, and will rebuild via the command line once done.

One thing that you really should change is to edit res/values/default-repo.xml and modify it to at least include your new server repo that you set up in part 1.
You probably also want to change no-trans.xml and the “about” clause to reflect your own installations too.
If you are rolling out a complete solution, don’t forget to check out strings.xml as well, so that your application makes sense!

Once that is done, you are free to look through the code to modify whatever else you think may be useful, but I think that the above should do for most situations. If you want to change the launcher icon etc, then create a new Android icon project in Eclipse and do it that way, as it is far easier than manually.

Once all your changes are done, rebuild and ship your brand new client!

ant clean emma debug install [test]


Android Intent to install app dependencies

I finally find myself actually having to learn Android app development properly now, and came up against an issue where I need my app to [optionally] install another app form my F-Droid repo or the Google Play store.

Luckily, either way, you should be covered as the Android framework is clever enough to parse the market:// URI’s as “generic package manager” so if you have a Free ROM that does NOT include Google Play services, you should still be OK with this code.

I have set a button click event to go and check if the app is installed, and then install it with an alert.

Button boButton = (Button) findViewById(R.id.bo_button);

        boButton.setOnClickListener(new View.OnClickListener() {

            public void onClick(View arg0) {

                    Intent intent = new Intent("com.dstv.boxoffice.android.SCAN");
                    startActivityForResult(intent, 0);
                } catch (Exception e) {
                    createAlert("BoxOffice Application not installed!", "This application uses " +
                            "the BoxOffice application by DStv, you need to install " +
                            "this before you can use this functionality!", true, "market://search?q=pname:com.dstv.boxoffice.client.android");


The intent above will fire off an alert (see code below) and prompt the user to install the required package.

private void createAlert(String title, String message, Boolean button, final String marketURL) {
        AlertDialog alertDialog;
        alertDialog = new AlertDialog.Builder(this).create();
        if ((button == true)) {
            alertDialog.setButton("Download Now",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface arg0, int arg1) {
                            Intent browserIntent = new Intent(