This article will guide you to build Android build your Android app with Premium Mobile Code. The article contains the following parts:
Now, let's start!
Note |
---|
The Premium Mobile Code is ONLY available on phpFox ULTIMATE license. In case you are holding other license types, please upgrade to phpFox ULTIMATE license first. In this article, we assume that you already got the following knowledge:
|
...
Install Nodejs & Dependencies
Info | ||
---|---|---|
| ||
If you are using Mobile code version 1.4 or newer, you no longer need to install Nodejs & Dependencies. This step can be bypassed. |
- Firstly, download and install the latest Nodejs version from https://nodejs.org/
...
- Go to Client Area and download the Premium Mobile Code (in Zip format).
- Extract Zip file to MobileProject folder (We just use the folder name MobileProject for example. You can use another folder name but should update all following commands and paths accordingly)
Install Project Dependencies
Info | ||
---|---|---|
| ||
If you are using Mobile code version 1.4 or newer, you no longer need to install Project Dependencies. This step can be bypassed. |
Run the following command to install necessary dependencies on the project
Code Block |
---|
#install dependencies cd MobileProject/ yarn install |
...
Visit Google Firebase platform (https://console.firebase.google.com/), create a project (You can use one Firebase project for both iOS and Android apps)
- Download google-services.json
- Overwrite the default file at MobileProject/android/app/google-services.json
...
Default file configuration.json will be as below:
Code Block |
---|
{ "appName": "YourAppName", "bundleId": "com.yourcompany.phpfoxmobile", "serverUrl": "https://yourphpfoxwebsite.com", "clientId": "CLIENT_ID", "clientSecret": "CLIENT_SECRET", "versionName": "x.x", "versionBuildNumber": x, "facebookAppId": "FACEBOOK_APP_IDxxx", "googlePlacesClientId": "GOOGLE_PLACES_CLIENT_ID", "googleAdMobAppIdstringKeyCodePush": "", "react-native-google-mobile-ads": { "android_app_id": "GOOGLE_ADMOB_APP_ID", "firebaseEnabledAnalytic "delay_app_measurement_init": false, "optimize_initialization": true, "versionName "optimize_ad_loading": "1.x.x"true }, "pingServerUrl": "", "versionBuildNumberfirebaseEnabledAnalytic": 2true, "theme": { "primaryColorsplashScreenBackgroundColor": "#COLOR", "splashScreenBackgroundColorprimaryColor": "#COLOR", "grayBaseColor": "#111", "welcomeText": { "fontSize": 24, "color": "#FFF", "fontWeight": 400 }, "welcomeImage": { "height": 48, "resizeMode": "contain" } }, "enableAssociatedDomains": true, "associatedDomains": [ "yourphpfoxwebsite.com", "www.yourphpfoxwebsite.com" ], "enableLiveStream": false, "enableRocketChat": true, "enableInAppPurchase": false, "enableAdmob": false, "enableAudio": false, "enableLog": false, "privateInfo": { "storeFile": "yourcompany.keystore", "storePassword": "xxxxxxxxxxxxxxxxx", "keyAlias": "yourcompany", "keyPassword": "xxxxxxxxxxxxxxxxxx" } } |
Here is our detailed explanation for items in this file
...
Follow instructions at https://developers.google.com/places/android-sdk/start to get this key for Android app.
googleAdMobAppIdandroid_app_id
Follow instructions at https://developers.google.com/admob/android/quick-start to get this key for Android app.
...
- versionName should follow the format "MAJOR.MINOR.PATCH". Ex: 1.0.3. For further information, please refer to https://semver.org/
- versionBuildNumber must be an Integer number.
primaryColor and splashScreenBackgroundColor
The primary color (in Hex color code, Ex: #2681D5) of your app. This color is applied to links, like button, navigation title, etc.
...
These items will be used when distributing Android app to Google Play. They can be generated within Android Studio.
Run
...
Nodejs
Info | ||
---|---|---|
| ||
If you are using Mobile code version 1.4 or newer, you no longer need to run Nodejs. This step can be bypassed. |
- Open Terminal, go to MobileProject folder
- Run the following command to start
Code Block |
---|
node ./server.js |
Run your Android app in Android Studio
- Start Android Studio and open Android project at MobileProject/android folder.
...
- Now you can start running your Android app in the simulator in Android Studio