/Gizee

🍱 Food calculator app | 📚 Menjadi Android Developer Expert class

Primary LanguageKotlinMIT LicenseMIT

Gizee

CircleCI GitHub release MIT License

Calculate calories and nutrients in your meals using Gizee. This Android-based app is powered by Nutritionix API and entirely well-written in Kotlin. Gizee is built using Clean Architecture which makes it robust, flexible, and maintainable. This app was developed as a capstone project in Dicoding's Become an Android Developer Expert (Menjadi Android Developer Expert) class.

Download

Check out the release page and download the latest apk.

MAD Scorecard

Architecture and Tech-stack

Project Configuration

Firstly, clone this repository and import it into Android Studio (git clone https://github.com/ariefzuhri/Gizee.git).

Setup API Key

  1. Get your Nutritionix API app id and app key.
  2. Create a new file named secrets.properties in the project root directory.
  3. Put your app id and key in secrets.properties file by adding the following lines:
NUTRITIONIX_APP_ID=YOUR_APP_ID
NUTRITIONIX_APP_KEY=YOUR_APP_KEY

Setup Firebase Crashlytics

To set up Crashlytics, you just need to register this app with the Firebase Project.

Create a Firebase Project

  1. Open the Firebase Console and click Add project (or select your existing Firebase project).
  2. When creating a new Firebase project, just follow the instructions and keep the Enable Google Analytics for this project option switched on.
  3. When using an existing Firebase project, ensure that Google Analytics is enabled (see the instructions in number 2 here).

Register the App

  1. In Project Overview, click Add app button and select the Android icon to register your Android app.
  2. Make sure the Android package name matches your app ID in the Android Studio project and you are not required to include the Debug signing certificate SHA-1.
  3. Download the google-services.json file and move it into Android app module root directory (./app).
  4. Skip the third step about Add Firebase SDK as the project already has the dependencies.

Setup Certificate Pinning

  1. Open the secrets.properties file.
  2. Add the following new lines (you can get the public key hashes here):
NUTRITIONIX_BASE_URL=https://trackapi.nutritionix.com/v2/
NUTRITIONIX_PUBLIC_KEY_1=fajdlzqjFkH3fU8/NrjW0d4cFANUzh/4HstyvlVaTqM=
NUTRITIONIX_PUBLIC_KEY_2=JSMzqOOrtyOT1kmau6zKhgT676hGgczD5VMdRMyJZFA=
NUTRITIONIX_PUBLIC_KEY_3=++MBgDH5WGvL9Bcn5Be30cRcL0f5O+NyoXuWtQdX1aI=
NUTRITIONIX_PUBLIC_KEY_4=KwccWaCgrnaw6tsrrSO61FgLacNgG2MMLq8GE6+oP5I=

Setup Database Encryption

  1. Open the secrets.properties file.
  2. Add the following new line:
DATABASE_PASSPHRASE=YOUR_ANY_PASSPHRASE

Setup CircleCI

  1. You need to fork this project first before setting up your own CircleCI environment.
  2. After that, register or connect your CircleCI account with GitHub.
  3. Follow the instructions here to set it up. In step number 2, select Fastest instead of Fast.
  4. Set all environment variables in project settings. You can see how to make it works here. The environment variables include all variables defined in secrets.properties file plus the following 2 variables:
DEBUG_KEYSTORE={your own default debug.keystore file encoded in base64}
GOOGLE_SERVICES={your own google-services.json file encoded in base64}

To encode files in base64 you can use OpenSSL by downloading from here (the light version is sufficient) and see how to run the command here.

Setup Signing Configuration (optional)

This step is optional for learning purposes. Since we don't need to publish the app to Google Play, you may skip this step and comment/remove the signing configuration in the app-level build.gradle.

  1. First, you need your own keystore. If you don't already have one, you can read how to create it here.
  2. Open the secrets.properties file and add the following lines:
STORE_FILE=YOUR_KEYSTORE_PATH
STORE_PASSWORD=YOUR_STORE_PASSWORD
KEY_ALIAS=_YOUR KEY_ALIAS
KEY_PASSWORD=YOUR_KEY_PASSWORD

To specify a file path, you can write its absolute (the full path) or just its relative path (the short version). See the details here.

🤝 Support

Any contributions, issues, and feature requests are welcome.

Give a ⭐️ if you like this project.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments