Documentation For Mobile Apps
Documentation For Mobile Apps
Doctor Appointment
Mobile Apps
1
Welcome to Doctro
We are more then happy to assist with any queries you have. this documentation is
for basic overview and about how to generate builds using this. Read this document
thoroughly if you are experiencing any difficulties.
2
Mobile Application Setup
3
Flutter installation
To install and run Flutter, your development environment must meet these minimum
requirements:
System requirements
• Operating Systems: macOS (64-bit)
• Disk Space: 2.8 GB (does not include disk space for IDE/tools).
• Tools: Flutter uses git for installation and upgrade. We recommend installing
Xcode, which includes git , but you can also install git separately.
$ export PATH="$PATH:`pwd`/flutter/bin"
This command sets your PATH variable for the current terminal window only. To
permanently add Flutter to your path, see Update your path.
4
Run the following command to see if there are any dependencies you need to install
to complete the setup (for verbose output, add the -v flag):
This command checks your environment and displays a report to the terminal
window. The Dart SDK is bundled with Flutter; it is not necessary to install Dart
separately. Check the output carefully for other software you might need to install
or further tasks to perform (shown in bold text).
For example:
The following sections describe how to perform these tasks and finish the setup
process.
Once you have installed any missing dependencies, run the flutter doctor
command again to verify that you’ve set everything up correctly.
You can also use git directly instead of downloading the prepared archive. For
example, to download the stable branch:
pdate Your Path, and run flutter doctor . That will let you know if there are
U
other dependencies you need to install to use Flutter (e.g. the Android SDK).
If you did not use the archive, Flutter will download necessary development
binaries as they are needed (if you used the archive, they are included in the
download). You may wish to pre-download these development binaries (for
example, you may wish to do this when setting up hermetic build environments, or
5
if you only have intermittent network availability). To do so, run the following
command:
The steps for modifying this variable permanently for all terminal sessions are
machine-specific. Typically you add a line to a file that is executed whenever you
open a new window. For example:
1. Determine the path of your clone of the Flutter SDK. You need this in Step 3.
2. Open (or create) the rc file for your shell. Typing echo $SHELL in your
Terminal tells you which shell you’re using. If you’re using Bash, edit
$HOME/.bash_profile or $HOME/.bashrc . If you’re using Z shell, edit
$HOME/.zshrc . If you’re using a different shell, the file path and filename will be
different on your machine.
3. Add the following line and change [PATH_OF_FLUTTER_GIT_DIRECTORY] to be the
path of your clone of the Flutter git repo:
$ export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
4. Run source $HOME/. to refresh the current window, or open a new terminal
window to automatically source the file.
5. Verify that the flutter/bin directory is now in your PATH by running:
Verify that the flutter command is available by running:
Platform setup
macOS supports developing Flutter apps in iOS, Android, and the web (technical
preview release). Complete at least one of the platform setup steps now, to be able
6
to build and run your first Flutter app.
iOS setup
Install Xcode
To develop Flutter apps for iOS, you need a Mac with XCode installed.
1. Install the latest stable version of XCode (using web download or the Mac App
Store).
2. Configure the XCode command-line tools to use the newly-installed version of
XCode by running the following from the command line:
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Develope
This is the correct path for most cases, when you want to use the latest version
of XCode. If you need to use a different version, specify that path instead.
3. Make sure the XCode license agreement is signed by either opening XCode
once and confirming or running sudo xcodebuild -license from the command
line.
Versions older than the latest stable version may still work, but are not
recommended for Flutter development. Using old versions of XCode to target bit
code is not supported, and is likely not to work.
With XCode, you’ll be able to run Flutter apps on an iOS device or on the simulator.
1. On your Mac, find the Simulator via Spotlight or by using the following
command:
2. Make sure your simulator is using a 64-bit device (iPhone 5s or later) by
checking the settings in the simulator’s Hardware > Device menu.
7
3. Depending on your development machine’s screen size, simulated high-screen-
density iOS devices might overflow your screen. Grab the corner of the
simulator and drag it to change the scale. You can also use the Window >
Physical Size or Window > Pixel Accurate options if your computer’s resolution
is high enough.
• If you are using a version of XCode older than 9.1, you should instead set the
device scale in the Window > Scale menu.
1. Create a new Flutter app by running the following from the command line:
2. A my_app directory is created, containing Flutter’s starter app. Enter this
directory:
3. To launch the app in the Simulator, ensure that the Simulator is running and
enter:
1. You can skip this step if your apps do not depend on Flutter plugins with native
iOS code. Install and set up Cocoa Pods by running the following commands:
$ sudo gem install cocoapods
8
c. Select the Runner project in the left navigation panel.
d. In the Runner target settings page, make sure your Development Team is
selected under Signing & Capabilities > Team.
When you select a team, XCode creates and downloads a Development
Certificate, registers your device with your account, and creates and
downloads a provisioning profile (if needed).
• To start your first iOS development project, you might need to sign into
Xcode with your Apple ID. Development and testing is supported for any
Apple ID. Enrolling in the Apple Developer Program is required to
distribute your app to the App Store. For details about membership
types, see Choosing a Membership.
• The first time you use an attached physical device for iOS development,
you need to trust both your Mac and the Development Certificate on that
device. Select Trust in the dialog prompt when first connecting the iOS
device to your Mac.
Then, go to the Settings app on the iOS device, select General > Device
Management and trust your Certificate. For first time users, you may
need to select General > Profiles > Device Management instead.
• If automatic signing fails in XCode, verify that the project’s General >
Identity > Bundle Identifier value is unique.
3. Start your app by running flutter run or clicking the Run button in XCode
Android setup.
Android setup
Install Android Studio
1. Download and install Android Studio.
2. Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This
installs the latest Android SDK, Android SDK Command-line Tools, and Android
SDK Build-Tools, which are required by Flutter when developing for Android.
3. Run flutter doctor to confirm that Flutter has located your installation of
Android Studio. If Flutter cannot locate it, run flutter config --android-
studio-dir to set the directory that Android Studio is installed to.
9
Set up your Android device
To prepare to run and test your Flutter app on an Android device, you need an
Android device running Android 5 (API level 21) or higher.
10
5. Under Emulated Performance, select Hardware - GLES 2.0 to enable hardware
acceleration.
6. Verify the AVD configuration is correct, and select Finish.
For details on the above steps, see Managing AVDs.
7. In Android Virtual Device Manager, click Run in the toolbar. The emulator starts
up and displays the default canvas for your selected OS version and device.
1. Make sure that you have a version of Java 8 installed and that your JAVA_HOME
environment variable is set to the JDK’s folder.
Android Studio versions 2.2 and higher come with a JDK, so this should already
be done.
2. Open an elevated console window and run the following command to begin
signing licenses.
$ flutter doctor --android-licenses
11
Setup An Editor With Flutter
Install the Flutter and Dart plugins
Mac
Use the following instructions for macOS:
Linux or Windows
Use the following instructions for Linux or Windows:
Install VS Code
VS Code is a lightweight editor with Flutter app execution and debug support.
12
Install the Flutter and Dart plugins
1. Start VS Code.
2. Invoke View > Command Palette….
3. Type “install”, and select Extensions: Install Extensions.
4. Type “flutter” in the extensions search field, select Flutter in the list, and click
Install. This also installs the required Dart plugin.
13
Adding Firebase
INITIAL CHECKLIST
https://console.firebase.google.com/
console.firebase.google.com
14
Let's create flutter app configs inside the Firebase
Project
15
Now install Firebase CLI. We recommend taking the Node(NPM) route which will
add Firebase CLI globally, which means it can be run from any terminal system-
wide.
16
NOTES:
• Do not opt for Chocolatey while installing the node. You won't need this, plus
it will install a WHOLE lot of unwanted things.
• If you have added/modified the system environment variables path during the
process, a system reboot is a must.
Then log in to Firebase via CLI Wizard. or run the command: firebase login from
system terminal
17
When CLI Wizard asks you for the platform, DO NOT CHOOSE any other than
Android or iOS
this CLI command will create & fetch configurations automatically in your project,
1 android/app/google-services.json
2 lib/firebase_options.dart
3 firebase.json
18
2. Goto Rules Tab
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
// allow read, write: if false;
allow read, write: if request.auth != null;
}
}
}
19
Enable Firebase Services
20
Setup of Agora video call
1. Create an account on Agora.
2. After completing the registration process, you will be redirected to the dashboard
page.
3. Navigate to the Projects management from left hand side panel of the dashboard.
4. After that, showing Project Management screen, in that click on create button.
21
5. Create New Project dialog will appear, fill all project related details.
22
6. your Project created successfully, after that, right side shows action column, in
that column click on config button.
23
7. project detail page will open, copy the App Id & App Certificate codes and set it in
the admin panel of your project.
8. In admin panel, click on Settings button from menu panel, under video call
setting option set your App Id & App Certificate and click on save button.
24
That's all for video call setup.
NOTE: Video Call Notification will not show up if OneSignal API Credentials are not
provided in the Notification Settings Tab
25
Setup to Firebase Chat Notification
1. After successfully creating Firebase database, Click the Settings icon next to
Project Overview on the left side of the Dashboard, after 3 options will opened
in which click on Project Settings.
2. Then project settings screen will open, in that click on Cloud Messaging, in which
copy the "server key".
26
3. Then put that server key in the Doctro project at the location below.
• Doctro Doctor
File Location is : - project/lib/chat/providers/chat_provider.dart.
• Doctro Patient
File Location is : - project/lib/FirebaseProviders/chat_provider.dart.
27
28
OneSignal
OneSignal Configuration on Backend (Admin)
STEP 1:
This one JSON file will work for all the apps which are within this One Firebase
Project
STEP 2:
Go to the OneSignal official site and add the specific platform SDK implementation.
Refer to: OneSignal Firebase Credentials Documentation
29
Next, Choose Flutter when onesignal asks for Platform/SDK choices.
STEP 3:
Copy and paste the OneSignal App ID into the Admin Panel >
Notification/OneSignal Settings > App ID input box.
Normally, API Key & Auth Key will be the same if you are using the same account of
OneSignal for all the apps, Still, contact OneSignal Support if you are not sure what
to do in their platform.
30
STEP 4:
Make sure you create two different apps in one signal—so 2 App IDs you will have.
NOTE: No matter if it’s Android or iOS, the APP ID will be the same on both
platforms. Mobile Apps will automatically use this via our backend APIs.
NOTE: Please note these App IDs to be entered in the Individual Mobile App
Configuration steps.
31
How to Change
BASE_URL(for User, Doctor)
For User Project
1. Open project code with android studio
2. From left pane : Select Project ->
3. here you can see all project folder
4. Select lib folder.
5. Open apis.dart file.
6. Select project -> lib -> api-> apis.dart File.
7. in this file you can see baseUrl: "Enter_Your_Base_Url/public/api/" : replace your
Server URL with it.
8. After replace URL.
9. at the bottom of android studio : TODO, Dart Analysis, Terminal buttons
available.
10. click on Terminal button.
11. execute command : - flutter pub get && flutter pub run build_runner build --
delete-conflicting-outputs wait for complete of the process.
12. Now follow steps of How to Generate APK file.
32
For Doctor Project
1. Open project code with android studio
2. From left pane : Select Project ->
3. here you can see all project folder
4. Select lib folder.
5. Open apis.dart file.
6. Select project -> lib -> retrofit-> apis.dart File.
7. in this file you can see baseUrl: "Enter_Your_Base_Url/public/api/" : replace your
Server URL with it.
8. After replace URL.
9. at the bottom of android studio : TODO, Dart Analysis, Terminal buttons
available.
10. click on Terminal button.
11. execute command : - flutter pub get && flutter pub run build_runner build --
delete-conflicting-outputs wait for complete of the process.
12. Now follow steps of How to Generate APK file.
33
NOTE : Base URL for app is : Enter_Your_BaseUrl/public/api/
34
Change App Stuff(for User)
Changes in Application for name, Package name, Application Color, Splash screen,
Application Icon.
<application
android:label="Your_App_Name" //Change this line
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher">
For iOS
• Go to below path and change app name which seems like this
<string>Your_App_Name</string>
<key>CFBundleName</key>
<string>Your_App_Name</string>
35
2. flutter pub get
36
For Doctor App :-
1. For Change Application color
go to lib/constant/color_constant.dart file and change color according to your need.
37
Add google map key(for User)
First of all getting google map keys for both Android and iOS.
Android :-
For Android, follow the instructions at Maps SDK for Android — Get API Key. Once
you have your API key, change it to your Flutter app in the application manifest
( android/app/src/main/AndroidManifest.xml ), change this
ENTER_YOUR_GOOGLE_ANDROID_KEY.
android:value="ENTER_YOUR_GOOGLE_ANDROID_KEY"/>
iOS :-
For iOS, follow the instructions at Maps SDK for iOS — Get API Key. Once you have
this key, add it to your Flutter app in the application delegate
( ios/Runner/AppDelegate.m ),change ENTER_YOUR_GOOGLE_iOS_KEY.
38
Localization/Translation
Patient App
Step 1:
• Create the JSON file of the language to be added in the following folder:
◦ Duplicate en.json and rename it based on your language.
◦ Folder path: lib -> localization -> languages
Step 2:
• Replace all English values with translated values. Change only values, not keys.
39
Step 3:
• Add your language constant variable in localization_constant.dart :
◦ File path: lib -> localization -> localization_constant.dart
Step 4:
• Add language-related code to localization_constant.dart .
40
Step 5:
• Open main.dart file and add a new language code with the country code.
Step 6:
• Add a new language number with a numeric value in ChangeLanguage.dart .
◦ File path: lib -> Screen -> Setting -> ChangeLanguage.dart
◦ Example: Language(4, 'Language Name', 'Country Code', 'Language
Code')
41
Doctor App
Step 1:
• Create the JSON file of the language to be added in the following folder:
◦ Duplicate en.json and rename it based on your language.
◦ Folder path: lib -> localization -> language
Step 2:
• Replace all English values with translated values. Change only values, not keys.
42
Step 3:
• Add your language constant variable in localization_constant.dart .
◦ File path: lib -> localization -> localization_constant.dart
Step 4:
• Add language-related code to localization_constant.dart .
43
Step 5:
• Open main.dart file and add a new language code with the country code.
Step 6:
• Add a new language number with a numeric value in language_model.dart .
◦ File path: lib -> localization -> language_model.dart
◦ Example: Language(3, 'Language Name', 'Country Code', 'Language
Code')
44
Done.
45
Run The App
Using Android Studio
Open the app files
Select File from top list menu, and chose open folder then select the project folder.
2- In the target selector, select an Android device for running the app. If none are
listed as available, select Tools> Android > AVD Manager and create one there. For
details, see Managing AVDs.
3- Click the run icon in the toolbar, or invoke the menu item Run > Run.
After the app build completes, you’ll see the app on your device.
Starter app
46
Open the app files
Select File from top list menu, and chose open folder then select the project folder.
2- Select a device from the Device Selector area. For details, see Quickly switching
between Flutter devices.
Warning: You may not see Start iOS Simulator option when you click No Devices
in VS Code. If you are on Mac then you may have to run following command in
terminal to launch a simulator.
4- Wait for the app to launch — progress is printed in the Debug Console view.
After the app build completes, you’ll see the app on your device.
47
Starter app
48
Install App To Your Android Device
Install app to your android device
Steps for: How to install application in android device
49
How to Generate APK file
In the project folder there will have 2 folders located 1st for user and 2nd for driver,
to generate both(user, driver) apk follow these steps.
50
How to Generate Signed APK
4. Select android
51
Click OK
52
Select Build Menu -> Generate Signed Bundle/APK..
53
After Selecting Generate Signed Bundle/APK.. You can see above dialog box.
54
You can see above dialog box :
If you are Generate first time signed apk at that time you need CREATE NEW
KEYSTORE PATH
so that first click on Create new... After click create new... , You can see below
dialog box
55
Fill Necessary Details : Key store path , Keystore Password Keystore confirm
Password, KEY Alias, Alias Password, Alias confirm password, validity(years),
Certificate: First & Last Name
NOTE : (Select a specific path where you want to store KEY STORE File. This file
will use while every time when you want to publish apk or Update application to
google play store. So that keep it safe location and save it.)
56
Key-----------
Validity : in years
Certificate :
Then you can see previous dialog box with keystore path filled as your given data.
Enter Keystore password , key alias , and key Password as you given while creating
keystore path.
57
Click NEXT
You can select Signature version for secure apk file from reverse engineering.
Click Finish.
58
How to publish APK
to Google play store
How to publish APK to Google play store
Here steps for Android application published on the Google play store:
To publish your application on the google play store you need to have a Developer
Account to publish your android application on the google play store.
https://play.google.com/apps/publish
The First Step to publish APK to google play store, We need to generate Signed
APK. (Regular Build APK can not be published on the google play store.)
If you have knowledge of how to generate a signed APK then you can go throw the
below link
59
Upload APK/App bundle
to Google play store
After Successfully Generation of Signed APK, you can publish it on Google play
store.
As pervious mentioned you must have Google developer / google play store
account to complete the process of it. Create and set up your app - Play Console
Help Starting August 2021, new apps will be required to publish with the Android
App Bundle on Google Play.
New apps larger than 150MB can use either Play Asset Delivery or Play Feature
Delivery. Reasupport.google.com
Thankyou
60