Soko App

# Soko

Soko is an android app for selling on a smartphone. You will receive updates as we make progress. The system has two interfaces, the admin interface which is in the cloud and the client side which is in the form of an android app. Most of the configurations are done on the backend and the changes reflect on the app.

In this document, I will walk you through the process of installing the php backend and then building the app upto placing the app on the playstore.

## What do I get?

I have provided a number of files to get you started. They include:

1. The Soko php back end
2. The Android App source code
3. Library projects and dependancies required for the app to run
4. Some photoshop files to quickly get you started

## Android Requirements

- Latest Eclipse ADT Bundle
- Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
- Mac OS X 10.5.8 or later (x86 only)
- Linux (tested on Ubuntu Linux, Lucid Lynx)
- GNU C Library (glibc) 2.7 or later is required.
- On Ubuntu Linux, version 8.04 or later is required. 64-bit distributions must be capable of running 32-bit applications.

## Server Requirements

- PHP version 5.1.6 or newer.
- A Database is required for most web application programming. Current supported databases are MySQL (4.1+), MySQLi, MS SQL, Postgres, Oracle, SQLite, and ODBC.

  ## Intalling the Soko backend.

  1. Upload the backend the server, you can use ftp or the cpanel file manager (If you have cpanel)
  2. Create a database and user. And assign the user that database
  3. On your browser visit the location of the back end.
  4. You will be prompted for the database name and user that you set up in step 2.
  5. Make sure that you check the option of removing the index.php from the url.

  ## Getting Started with the backend

  1. Build the categories menu. To do so go to Catalogue -> Categories.
  2. Add products from Catalogue -> Products
  3. Next add banners from Content -> Banners.
  After doing this the backend is now ready. You can still do more, but this are the ones required for the app to work.

  ## Intalling the latest version of Eclipse ADT.

  Soko is built with the latest Eclipse Luno version 4.4.0 and Android Development Tools 23.0.2.1259578. NOTE: There are several other tools to build and run android projects the second in popularity after Eclipse being Android Studio. If you do have Android Studio already installed you can skip installation of Eclipse section and go to Import sections. However, I would still advise you to install the Eclipse ADT all the same.

  1. Go to the Android Developer Page
  2. Download the Eclipse ADT. This should contain the latest version of ecipse and ADT plugin
  3. Extract the files somewhere on your computer.
  4. Run Eclipse.exe

  ## Get an API key from PayPal

  The current payment method being used is Paypal. If you are going to use it, you will need an API key from paypal. This whole process is docomented in detail at the paypal developer page

  1. Log in to the Developer portal with your PayPal account and navigate to the My REST apps page. Click Create App to begin the application-creation process.
  2. Take note of the `Client ID` and enter it in the `config.java` file. This will be found at the `com.gilo.soko.config package.`

  ## Import Soko Project to Eclipse

  1. On Eclipse go to File -> Import
  2. Choose Android -> Existing Android Code Into Workspace then click Next
  3. Browse to the location of the folder called source folder. I
  4. The folders should appear at the import window.
  5. Check the "copy project into workspace" checkbox
  6. Then click on Finish
  7. Let eclipse finish building the three projects into your workspace. Don't worry about the errors indicated by red 'x' marks for now. Check the progress at the bottom right corner of eclipse.

  ## Add the AppCompat

  1. Once Eclipse is Done. You should have two folders on your workspace. If you not then probably you did not import the projects properly or left out one or the other. Just repeat step 2 above.
  2. At this point Soko may have several errors. This is due to a missing library. Left Click on the Soko Library and go to Properties.
  3. Select Android on the left sidebar.
  4. Remove any library indicated in red 'x'.
  5. The click Add and choose the AppCompat lib.
  6. Repeat this for all the other library folders , that is the Sliding Menu folder, the Horizontal ListView folder ...
  7. Click apply
  8. Click finish.
  At this point there should be no more errors on the project.

  ## Troubleshooting Errors.

  If you still have errors then it could mean:
  1. You did not install eclipse properly. I would suggest create a new dummy android project. Go to File -> New Android Application.
  2. Enter the app name. Just press next until the end.
  3. Once Eclipse is done building, check if the new project also has errors.
     A.) If it does have errors, then ADT plugin was not setup properly. Update the ADT plugin NOTE: This should really not happen if you installed Eclipse ADT bundle from step 1. If it does and not seem to be working then contact us immediately.
     B.) If it does not have errors then the problem lies on the source file. Make sure you have imported correctly. If you did not use step 1 above, then maybe it could be something wrong with your Android Development Setup. Consider checking for updates.
  At this point there should be no more errors on the project.

  ## App Confiurations

  1. Open the `config.java` file. This will be found at the `com.gilo.soko.config package.`
  2. Change the `STORE_URL` to the url to your backend
  3. Add a `FLATRATE_SHIPPING`. This is the cost of shipping. This is the current method of shipping.

  ## Run Soko

  1. You can run your android applications on your phone or emulator. Start the emulator or plug in the phone into the computer.
  2. Left Click on the Soko Folder then Run As -> Android Application.
  3. In the next dialog, you should see the phone you plugged in as one of the devices. If you phone is not indicated then the phone drivers is not installed on the computer. (Tip: The apk file is found in the bin directory, you can directly copy into the phone and install from the phone)
  4. Eclipse will launch an emultaor if no device is found.

  # Prepare to Publish the app

  Before publishing the application to Google Play, make sure you have:

  1. Change the launcher icon in `res/drawable-*/ic_launcher.png`
  2. Change the application name in `res/values/strings.xml`
  3. Change the package name in `AndroidManifest.xml`

  ## Change Launcher icon

  Replace the following files in the `res` folder, with your own icon named `ic_launcher.png` :

  - `res/drawable-hdpi/ic_launcher.png` with 72x72 px
  - `res/drawable-xhdpi/ic_launcher.png` with 96x96 px
  - `res/drawable-xxhdpi/ic_launcher.png` with 144x144 px
  - `res/drawable-xxxhdpi/ic_launcher.png` with 192x192 px

  Note: You need the 512x512 px size for publishing to Google Play.

  ## Change Application name

  The application name can be changed from the `strings.xml` file in the values folder.

  1. Open the `res` folder
  2. Navigate to the values folder and open the strings.xml file
  3. Change the `app_name` value to the name you want

  ## Changing package name

  Every application in Google Play has an unique application name usually in the form of `com.example.app`. Before you can publish your application you need to change the application name to something unique (like use your domain as prefix in reverse order). To change it, you need to:

  1. Run ADT and open the project
  2. Right click on the project
  3. From the popup menu select `Android Tools`->`Rename Application Package`
  4. Enter your new package name and press `OK`
  5. Press `Finish`
  6. Then go to `res/strings.xml` and change the package_name string entry to your new package name

  That's it.

  ## Uploading to the Playstore

  A unique signed application needs to be sent to the playstore. To do that:

  1. First make sure that Lint Errror checking has been turned off. To do that go to Preference -> Android
  2. Select Lint Error Checking
  3. Uncheck the "Run full error checking when expoting app"
  4. Click on apply then OK
  Now we can export the app:
  1. Left click on the project and go to Android Tools
  2. Click on the "Export Signed Application"
  3. Create a new keystore
  4. Set the password
  5. Set you alias
  6. Select the location of where to save the apk

  That's it.

  ## Rating & Suggestions

  Go ahead and give us a 5. We know we are the best

  If you got any suggestion us or feautures tell us about it at the comment section or email me Soko@kimutai.org

  ## Credits

  - Helvetica Font

  Once again, thank you so much for purchasing this theme.