Documentation for Android Food Ordering Application

Thank you so much for purchasing my android source code for android food ordering app. I hope it will serve the purpose it is meant for.

The Android food ordering application has two section – the client android application and server web admin plane.

The complete project folder contain AndroidFoodOrdering folder, restaurant folder, sql file and EER design file and documentation.

Android Client App

Open the android project in Android Studio, make sure you have latest version of android, tools and extras.

androidfoodordering package folder

Open the androidfoodordering package, then double click to open the util folder. Inside the util folder, open the Helper.java file and change the link that reads PUBLIC_FOLDER. This is the path to your server web application.

public static final String PUBLIC_FOLDER = "server_path/restaurant/public/";
public static final String PUBLIC_FOLDER = "server_path/restaurant/public/";

In order to make use of PayPal payment, you are going to add your PayPal client id in the constant below.

public static final String CLIENT_ID = "";

 map package folder

Open the map package folder. This is where we store all the files that were used to implement Android Google Map.

Remember that the map measures the distance and duration between the user address and the restaurant location so it makes use of Google Direction API. In order to use this API, use are going to sign up with Google and obtain your own Google API Key. Please note that the API usage is free with cretain request limit.

Inside the bean folder, open Constant.java file and add your API Key value in the line below

public static final String API_KEY = "";

Android Google Map also requires an API_KEY. In the Google Services API console, sign up for android Google Map API. Once you obtain the value, go to your res folder, then you will see a folder named values. Open the values folder and double click to open the file named google_maps_api.xml. Add your API key as shown below.

<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false"></string>

You can read more about Android Google Map here – https://developers.google.com/maps/documentation/android-api/start

notification package folder

In order to set up android push notification in you are app, you need to create an account with Google Firebase. You can follow the link below

https://firebase.google.com/

When you have created an account and login inside your console, click on create a new project button to create a new project. Name the project anything you want, select your country or region and proceed.

Inside the console, you will see the Firebase overview menu in the left-hand side. Click on add an app and select android. Fill your app package name and other information and click the add button.

This process will download a file named google-service.json. Copy this file and add it to your android project app folder.

Inside the notification package, open the Helper.java file and add the path to your server where Firebase client token will be stored

public static final String PATH_TO_SERVER_TOKEN_STORAGE = "";

Web Application

The server side web application was built with Slim 3 Php framework and MYSQL database. If you have not heard or work with Php Slim Framework, I will suggest you read more about it here – https://www.slimframework.com/

Please not that Slim3 Framework requires Php version 5.5 and above.

Copy the web application folder name restaurant to the root public folder in your web server.

Open the restaurant folder, double click to open the settings.php to configure your database connection details

'db' => [
'driver' => 'mysql',
'host' => '',
'database' => '',
'username' => '',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
],

Add your database server credentials for host, database, username and password.

Create Database Tables

The database contains six tables.

1. food_menu_category

2. food_menu_item

3. food_order

4. food_restaurant

5. food_user

6. order_menu_item

The .sql file for the database table creation is added inside the folder. You can import this file inside in your database or you can create individual tables using the sql scripts below.

1. food_menu_category

CREATE TABLE IF NOT EXISTS `food_menu_category` (
  `menu_id` int(10) NOT NULL AUTO_INCREMENT,
  `menu_name` varchar(100) NOT NULL,
  `menu_image` varchar(200) NOT NULL,
  `created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
  PRIMARY KEY (`menu_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

2. food_menu_item

CREATE TABLE IF NOT EXISTS `food_menu_item` (
  `menu_item_id` int(10) NOT NULL AUTO_INCREMENT,
  `menu_id` int(10) NOT NULL,
  `item_name` varchar(100) NOT NULL,
  `description` text NOT NULL,
  `item_picture` varchar(100) NOT NULL,
  `item_price` float NOT NULL,
  `item_quantity` int(8) NOT NULL,
  `item_options` varchar(200) DEFAULT NULL,
  `item_notes` varchar(400) DEFAULT NULL,
  `hot_deal` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
  PRIMARY KEY (`menu_item_id`),
  KEY `menu_id` (`menu_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

3. food_order

CREATE TABLE IF NOT EXISTS `food_order` (
  `order_id` bigint(10) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(10) NOT NULL,
  `order_quantity` int(4) NOT NULL,
  `order_price` float NOT NULL,
  `order_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status` varchar(70) NOT NULL,
  `payment_method` varchar(50) NOT NULL,
  `created_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
  `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
  PRIMARY KEY (`order_id`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

4. food_restaurant

CREATE TABLE IF NOT EXISTS `food_restaurant` (
  `restaurant_id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `description` text NOT NULL,
  `address` varchar(200) NOT NULL,
  `phone` varchar(40) NOT NULL,
  `email` varchar(70) NOT NULL,
  `opening_time` varchar(500) NOT NULL,
  `created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
  PRIMARY KEY (`restaurant_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

5. food_user

CREATE TABLE IF NOT EXISTS `food_user` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `username` varchar(70) NOT NULL,
  `email` varchar(70) NOT NULL,
  `password` varchar(70) NOT NULL,
  `role` tinyint(2) NOT NULL DEFAULT '0',
  `address` varchar(100) NOT NULL,
  `phone_number` varchar(32) NOT NULL,
  `created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

6. order_menu_item

CREATE TABLE IF NOT EXISTS `order_menu_item` (
  `order_id` bigint(10) NOT NULL,
  `menu_item_id` bigint(10) NOT NULL,
  `quantity` int(4) NOT NULL,
  `price` float NOT NULL,
  `subtotal` float NOT NULL,
  `options` varchar(100) NOT NULL,
  `notes` varchar(200) NOT NULL,
  `created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
  KEY `order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Once you set up your database then proceed to the following link to make sure that your web configuration is working well in your web browser.

http://path_to_your_server/restuarant/public

Questions and Suggestions

If you have any question regarding the set-up, this documentation is host online in my website and you can access it using the following link.

You can ask any question related to android food ordering application.

Modification or Customization

Please note that you are free to customize or modify your application to suit whatever need you plan to use it for. But in the case that you will like me to customize it for you, then I will charge a fee to do that.

Term of Usage

This source code is provided for education purpose for students and android developers who want to understand how to create android food ordering app. If you intend to use this source code outside what it was meant for, I am not in any way responsible for it.

Copyright

You are not in anyways allowed to resell this source code or part of the source code to anybody. If you plan to resell this source code, kindly contact me. The usage of this source code cover education purposes and publishing to app stores.

9 Comments

    • Henry

Add a Comment