# Generating apps
###### tags: `Tutorials`
## Workflow
The mobile app development part of Triptale is divided in the in multiple repositories.

## Android
## Requirements
Right now this has only been tested on Ubuntu 18/19 and Linux Mint 18.2 Sonya.
**Please note that your distro needs to be able to run Vulcan if you want to use a virtual phone for testing**
Download the following :
* Latest JDK
* Android studio
Clone the following repo : https://bitbucket.org/triptale/android-app-generator/src/master/
**Make sure to always use the master or dev branch, unless you're willing to add a new feature.** If so, make sure to update the read-me and to use the appropriate feature branches.
## Setup
From the root folder of the repo, create the following folders :
* '/apps', this will be where you put the downloaded bundles from the CMS
* '/Build'
Verify the integrity of the zip file :
* If your build doesn't contain any images (doesn't have a 'res' folder) please do add one directly into the zip
Build the app :
* If the app is going to use Firebase, then download the appropriate google-services.json file from firebase console ( https://console.firebase.google.com ) and run :
```$ ./panda-generate-project apps/{{BUNDLE_NAME}}.zip -f /path/to/google-services.json```
* Else simply run :
```$ ./panda-generate-project apps/{{BUNDLE_NAME}}.zip```
Open project
* Open Android Studio
* Choose "Open an existing Android Studio project" and pick the panda_application folder under the Build folder
### Deploy on Play Store
#### Generating a bundle
Go to **Build > Generate Signed Bundle or APK** then :
* Select 'Android App Bundle'
* Download the key store in 1password under the 'Android - Key store' name
* Fill out the required information then hit 'Next'
* Select the 'productionRelease', hit 'Finish'
#### Verifying 64-bit dependencies
Go to **Build > Analyze APK** then :
* Make sure to select the .aab file you generated for release.
* Under **base/lib** you will find multiple folders
* To make sure the app is 64-bit compliant, you must make sure that all the files under the 'x86' and 'armeabi' are also present in their 64-bit counterpart, following this logic :
* 'x86' > 'x86_64'
* 'armeabi' > 'arms64' (version is not really important, at this time 'arms64-v8a' is latest and will support most architecture)
#### Creating a new App
Go to 'https://play.google.com/console' with the 'script@html24.net' account, then :
* Select **Create application**. Default language should be English and title at your convenience.
You're now greeted by a very large form. Google won't let you create and upload your app until you fill-in a bunch of information about it. This process can be very long and will appear tedious at first, especially when you just want to have a test track asap.
If the client didn't give you any sort of image resources yet, you'll need to use an advanced graphic editor. I strongly recommend using GIMP for it's portability and how effective it ends up being for the upcoming task. At the moment we do not have any default asset pack, so we're going to have to create a few images :
* An **512x512 32-bit PNG** that will be used as an icon
* 2 **at least 320x320 JPEG or 24-bit PNG (no alpha)** that will be used as screenshot/preview
* A **1024x500 JPG or 24-bit PNG (no alpha)** that will be used as 'Feature graphics'
Once done, fill out the form accordingly. Title, Short description and Full description should probably be up to the client. However there's a few fields that should be set to the following, unless told so :
* Application type : Applications
* Category : Travel & Local
* Website : (temporary) http://www.triptale.net
* Email : support@triptale.net
Save the draft, and proceed with uploading a release in the **App release** section. Whether you just want to use the Internal testing track or immediately go to production, you won't be able to fill out all the required information unless you've pre-uploaded your app. Proceed according to the **Handling development tracks** section of this wiki.
Now in order to be able to fully roll out the release we need to complete these 5 different areas thoroughly.
<img style="margin-right: 10px; vertical-align:top; display: inline-block; float: left;" src="http://wiki.html24-dev.dk/_media/triptale:complete.png?&w=168&h=500&tok=aea40c">
In the **Content rating** section :
* **Start new questionnaire**
* Select **Reference, News or Educational** category.
* Select **No** to all the questions, press Save
In the **App content** section :
* Go to **Ads**, select **No, my app does not contain ads**. Save and come back to the previous menu.
* Go to **App access**, select **All functionality is available without special access**. Save and come back to the previous menu.
* Go to **Target audience and content**, select : **13-15, 16-17 and 18 and over** (unless told otherwise)
* Press Next, Next, and finally Save.
Next go to the **Pricing and distribution** section :
* Select **Free**
* Select **Available** for **All countries** (unless told otherwise)
* Accept both **Content guidelines** and **US export laws** (unless told otherwise)
* Save the draft
At this point you should be good to go.
Go back to the **App release** section :
* **Manage** the according track
* **Edit/Review** the release, and proceed to the roll-out option
If the roll-out option is not available, this could be because of Google having issues at the moment, or because you might be missing some pre-conditions.
#### Handling development tracks
Go to 'https://play.google.com/console' with the 'script@html24.net' account, then :
* Go to **Release management** > **App releases**
* Select **Manage** on the desired track
* Now it's important to check the 'version code' of the current release and to make sure that you made a build with a higher number. If that's not the case, look for the ```android:versionCode``` parameter line in the AndroidManifest.xml in android studio and increment the number accordingly (+1, +5 or 10), then rebuild like we did earlier
* Once you've made this verification. select **Create a new Release**
* Upload the bundle we generated earlier. If you get any error at this point, simply follow google instructions.
* Make sure to give a good descriptions in the 'What's new in this release?' section, as this will be the description of the update in the play store.
* Proceed and fill out the necessary information then select **Review**
* If you are doing an update, the next screen can be skipped, but it can always be interesting to see if we're supporting more or less devices than before. Do not panic if we're not supporting 100+ device all of a sudden. The users will still be able to use the older version of the app
* Google takes about 1 to 2 days to review the roll-out if you are pushing to the production track, it's perfectly normal if your update is not available on the shop immediately. During this time they will check if there is any sort of exploit or intrusive logic in the app
* Notify the client in case of a prod push :)
## iOS (WiP)