ebook img

Mobile Tutorial: Using the Web Browser Component (iOS and Android) PDF

352 Pages·2015·9.78 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Mobile Tutorial: Using the Web Browser Component (iOS and Android)

Product Documentation RADStudio Mobile Tutorials Version Seattle © 2015 Embarcadero Technologies, Inc. Embarcadero, the Embarcadero Technologies logos, and all other Embarcadero Technologies product or service names are trademarks or registered trademarks of Embarcadero Technologies, Inc. All other trademarks are property of their respective owners. Embarcadero Technologies, Inc. is a leading provider of award-winning tools for application developers and database professionals so they can design systems right, build them faster and run them better, regardless of their platform or programming language. Ninety of the Fortune 100 and an active community of more than three million users worldwide rely on Embarcadero products to increase productivity, reduce costs, simplify change management and compliance and accelerate innovation. The company's flagship tools include: Embarcadero® Change Manager™, CodeGear™ RAD Studio, DBArtisan®, Delphi®, ER/Studio®, JBuilder® and Rapid SQL®. Founded in 1993, Embarcadero is headquartered in San Francisco, with offices located around the world. Embarcadero is online at www.embarcadero.com. August, 2015 Embarcadero Technologies 2 C ONTENTS Mobile Tutorials: Mobile Application Development (iOS and Android) ................. 11 Setup ................................................................................................................................. 11 Using Basic User Interface Elements ............................................................................. 12 Using Device Functionality ............................................................................................ 14 Using Backend as a Service .......................................................................................... 15 Accessing a Database .................................................................................................. 15 See Also ......................................................................................................................... 16 Mobile Tutorial: Set Up Your Development Environment on the Mac (iOS) .......... 17 Requirements on the Mac and iOS .......................................................................... 17 Steps to Configure Your Mac to Run Your iOS Application .................................. 17 Step 1: Install the Platform Assistant ...................................................................... 18 Step 2: Run the Platform Assistant ......................................................................... 19 Step 3: Install Xcode on the Mac .......................................................................... 20 Next Steps ................................................................................................................. 21 Additional Steps to Configure Your Mac to Run Your iOS Application on Your iOS Device............................................................................................................................... 21 Step 1: Make Sure that the Xcode Command Line Tools Are Installed on Your Mac ............................................................................................................................... 22 Step 2: Sign Up for a Developer Account ............................................................... 23 Step 3: Request, Download and Install Your Development Certificate ............. 23 Request, Download and Install Your Certificate ................................................ 23 Step 4: Register Your Device for Deployment ......................................................... 25 Step 5: Create and Install a Provisioning Profile ..................................................... 25 See Also ......................................................................................................................... 27 Mobile Tutorial: Set Up Your Development Environment on Windows PC (iOS) ... 28 Setting Up Your RAD Studio Environment ................................................................ 29 Create a Connection Profile for the Mac ........................................................... 29 Add an SDK to the Development System for the iOS Device Connected to the Mac ..................................................................................................................... 31 See Also ......................................................................................................................... 33 Mobile Tutorial: Set Up Your Development Environment on Windows PC (Android) .......................................................................................................................... 34 Setting Up Your RAD Studio Environment ................................................................ 34 Android Development Tools Are Installed with RAD Studio .............................. 35 Adding Your Android SDK in Tools Options > SDK Manager ............................. 36 Installing the USB Driver for Your Android Device (Required) ............................... 40 See Also ......................................................................................................................... 41 Mobile Tutorial: Creating an Application for Mobile Platforms (iOS and Android) ........................................................................................................................................... 42 Before You Start ........................................................................................................... 42 Step 1: Create a New FireMonkey Application for Android or iOS ..................... 42 Embarcadero Technologies 3 Step 2: Select a Style ................................................................................................... 44 Step 3: Place Components on the Multi-Device Form .......................................... 44 Step 4: Adding Views to Your Project....................................................................... 47 Step 5: Write an Event Handler for a Button Click by the User ............................. 47 Step 6: Test Your Mobile Application ........................................................................ 48 Test Your Android Application on the Android Device ..................................... 49 Test Your iOS Application ....................................................................................... 50 See Also ......................................................................................................................... 52 Mobile Tutorial: Using a Button Component with Different Styles (iOS and Android) ............................................................................................................................ 53 Buttons in Mobile Platforms ........................................................................................ 53 Define the Look and Feel for a Button Component .............................................. 54 Using TintColor and IconTintColor on Buttons ..................................................... 55 Using Styled and Colored Buttons on Target Platforms ..................................... 57 Placing an Image over a Button ........................................................................... 57 Create a Segmented Control Using Button Components ................................... 58 Create a Scope Bar on a Toolbar Component ..................................................... 60 Important Differences Between a TButton and TSpeedButton ............................ 60 See Also ......................................................................................................................... 60 Mobile Tutorial: Using a Calendar Component to Pick a Date (iOS and Android) ........................................................................................................................................... 62 Calendar in Mobile Platforms .................................................................................... 62 Implementing an Event Handler for User Changes to the Date .......................... 64 See Also ......................................................................................................................... 65 Mobile Tutorial: Using Combo Box Components to Pick Items from a List (iOS and Android) ............................................................................................................................ 67 Implementing a Picker in Multi-Device Applications ............................................. 67 Building a List of Items Using Code ........................................................................... 69 Displaying a Specific Item .......................................................................................... 70 Implementing an Event Handler for the User's Selection ...................................... 71 See Also ......................................................................................................................... 73 Mobile Tutorial: Using a Map Component to Work with Maps (iOS and Android) ........................................................................................................................................... 74 Basic Features of the TMapView Component ........................................................ 75 Creating a Sample Application ................................................................................ 75 Configuring Android Applications to Use the TMapView component ........... 75 Designing the User Interface .................................................................................. 75 Running the Sample Application .............................................................................. 80 See Also ......................................................................................................................... 81 Code Samples.......................................................................................................... 82 Configuring Android Applications to Use Google Maps .......................................... 83 Getting the Google Maps API key ........................................................................... 83 Retrieving Your Application Certificate ............................................................... 83 Creating an API Project in the Google APIs Console ........................................ 84 Embarcadero Technologies 4 Requesting a Maps API Key ................................................................................... 85 Configuring Specific Project Options ....................................................................... 85 See Also ......................................................................................................................... 88 Code Samples.......................................................................................................... 88 Mobile Tutorial: Using a MultiView Component to Display Alternate Views of Information (iOS and Android)...................................................................................... 89 About the TMultiView Component ........................................................................... 89 Master Pane Presentation Modes ......................................................................... 90 Designing the User Interface ..................................................................................... 96 Designing the Master Pane .................................................................................... 96 Designing the Detail Pane...................................................................................... 97 Implementing the Camera Buttons Functionality .............................................. 97 Setting the TMultiView Component Properties ................................................. 101 Running the Example Application .......................................................................... 101 Mobile Product Samples that Use TMultiView ....................................................... 102 See Also ....................................................................................................................... 102 Mobile Tutorial: Using the Web Browser Component (iOS and Android) ............ 103 Design the User Interface ......................................................................................... 104 Write an Event Handler to Open a Web Page when the User Changes the URL in the Edit Control ...................................................................................................... 106 Implement a Common Method to Open a Web Page .................................. 107 Implement an Event Handler for the OnChange Event ................................. 108 Implement an Event Handler for the Back Button ........................................... 108 Selecting the Proper Virtual Keyboard for the Web Browser Application ....... 109 WebBrowser Mobile Code Snippet ........................................................................ 110 See Also ....................................................................................................................... 110 Mobile Tutorial: Using Tab Components to Display Pages (iOS and Android) .... 112 Using the Native Style for Tabs on iOS and Android ........................................ 112 Designing Tab Pages Using the Form Designer .................................................... 113 Comparing the Tab Settings on iOS and Android ............................................ 118 Using Custom Multi-Resolution Icons for Your Tabs .............................................. 123 Displaying Multi-Resolution Custom Icons on Tabs ........................................... 124 Using a Single-Resolution Bitmap for a Custom Icon ....................................... 127 Defining Controls within a TabControl ................................................................... 129 Changing the Page at Run Time ............................................................................ 131 By the User Tapping the Tab ................................................................................ 131 By Actions and an ActionList ............................................................................... 131 By Source Code ..................................................................................................... 136 See Also ....................................................................................................................... 138 Mobile Tutorial: Using LiveBindings to Populate a ListView (iOS and Android) ... 139 Step 1: Creating the Project .................................................................................... 139 Step 2: Adding Fields ................................................................................................ 140 Step 3: Creating LiveBindings .................................................................................. 142 Step 4: Adding More Fields (Bitmaps, Currency) .................................................. 144 Embarcadero Technologies 5 Step 5: Adding the onButtonClick Event Handler ................................................ 146 The Results ................................................................................................................... 147 See Also ....................................................................................................................... 148 Mobile Tutorial: Using ListBox Components to Display a Table View (iOS and Android) .......................................................................................................................... 149 Using ListBox Components to Display a Table View in Mobile Platforms .......... 149 Plain List ................................................................................................................... 149 Grouped List ........................................................................................................... 150 Search Box .............................................................................................................. 151 Create Items on the ListBox Component .............................................................. 151 Add a Header ........................................................................................................ 154 Add a Group Header/Footer to the List ............................................................. 155 Show List Items as Separate Grouped Items ..................................................... 156 Add a Check Box or Other Accessory to a ListBox Item ................................. 157 Add an Icon to a ListBox Item .............................................................................. 157 Add Detail Information to an Item ...................................................................... 158 Running Your Application .................................................................................... 158 Create Your ListBox Application ............................................................................. 158 Add Items to a ListBox from Your Code ............................................................. 159 Create an Overflow Menu ................................................................................... 162 Creating the Event Handler for the Overflow Button ...................................... 164 Add a Search Box .................................................................................................. 165 Running Your Application .................................................................................... 166 See Also ....................................................................................................................... 167 Mobile Tutorial: Using LiveBindings to Populate a ListBox in Mobile Applications (iOS and Android) ......................................................................................................... 168 Step 1: Creating the Project .................................................................................... 168 Step 2: Creating the LiveBindings ........................................................................... 171 The Results ................................................................................................................... 173 See Also ....................................................................................................................... 174 Mobile Tutorial: Using Layout to Adjust Different Form Sizes or Orientations (iOS and Android) ................................................................................................................. 175 Every FireMonkey Component Can Have an Owner, a Parent, and Children ...................................................................................................................................... 175 Using Common Layout-Related Properties of a FireMonkey Component ...... 175 Using the Align Property........................................................................................ 175 Using the Margins Property ................................................................................... 177 Using the Padding Property ................................................................................. 177 Using the Anchors Property .................................................................................. 178 Using the TLayout Component ............................................................................... 179 See Also ....................................................................................................................... 180 Mobile Tutorial: Taking and Sharing a Picture, and Sharing Text (iOS and Android) ......................................................................................................................................... 181 Topics .......................................................................................................................... 184 Embarcadero Technologies 6 See Also ....................................................................................................................... 184 Mobile Tutorial: Using Location Sensors (iOS and Android) .................................... 185 Design the User Interface ......................................................................................... 186 The Location Sensor .................................................................................................. 187 Read Location Information (Latitude, Longitude) from the LocationSensor Component ................................................................................................................ 188 Show the Current Location Using Google Maps via a TWebBrowser Component ................................................................................................................ 190 Use Reverse Geocoding .......................................................................................... 191 Show a Readable Address in the ListBox Component ........................................ 194 Describing Why Your Application Needs the User Location .............................. 195 See Also ....................................................................................................................... 195 Mobile Tutorial: Using Notifications (iOS and Android)............................................ 196 Three Basic Notification or Alert Styles ................................................................... 196 Notification Banner on Mobile Devices ............................................................. 196 Alert Dialogs: iOS Badge Number and Android Notification Number .......... 197 Notification Center on Mobile Devices ................................................................. 197 Access the Notification Service .............................................................................. 198 Add FMLocalNotificationPermission (iOS 8 Only) ................................................. 199 Set the Icon Badge Number and Notification Number from Code ................. 199 Schedule Notification ............................................................................................... 201 Repeat a Notification Message .............................................................................. 203 Update or Cancel a Scheduled or Repeated Notification Message .............. 204 Present the Notification Message Immediately ................................................... 205 Customizing the Notification Sound ....................................................................... 207 Notification Banner or Notification Alert ................................................................ 211 Add Action to the Notification Alert (iOS Only).................................................... 212 Add Action to Notifications ..................................................................................... 214 Running the Application .......................................................................................... 215 See Also ....................................................................................................................... 215 Mobile Tutorial: Using Remote Notifications (iOS and Android) ............................ 216 Remote Push Notification ........................................................................................ 216 REST BAAS framework ............................................................................................... 217 Topics in this Mobile Tutorial ..................................................................................... 217 See Also ....................................................................................................................... 217 Code Samples........................................................................................................ 217 Multi-Device Application to Receive Push Notifications ........................................ 218 Design and Set Up the User Interface .................................................................... 218 Creating the Event Handlers ................................................................................... 223 Android Settings......................................................................................................... 226 Project Settings ....................................................................................................... 226 iOS Settings ................................................................................................................. 227 Project Settings ....................................................................................................... 227 Running Your Application on a Mobile Device .................................................... 227 Embarcadero Technologies 7 See Also ....................................................................................................................... 231 Code Samples........................................................................................................ 231 Mobile Tutorial: Using the Phone Dialer on Mobile Devices (iOS and Android) .. 232 About the Phone Dialer Services on Mobile Devices .......................................... 232 Accessing the Phone Dialer Services ..................................................................... 232 Designing the User Interface ................................................................................... 234 Getting the Carrier Properties ................................................................................. 234 Running the Application....................................................................................... 235 Making a Call ............................................................................................................. 236 Detecting the Call State Changes ......................................................................... 239 Implementing the OnCallStateChanged Event Handler ................................ 239 See Also ....................................................................................................................... 243 Mobile Tutorial: Using BaaS for Backend Storage (iOS and Android) ................... 244 Getting Your App Ready in Kinvey and Parse ...................................................... 245 Design and Set Up of the User Interface ............................................................... 245 Adding the Backend Components ........................................................................ 246 Creating and Storing Objects ................................................................................. 248 Deleting Objects........................................................................................................ 249 Retrieving Objects ..................................................................................................... 251 Running Your Application ........................................................................................ 254 See Also ....................................................................................................................... 256 Code Samples........................................................................................................ 256 Mobile Tutorial: Using InterBase ToGo with dbExpress (iOS and Android) ........... 257 Using dbExpress to Connect to the Database ..................................................... 258 Design and Set Up the User Interface .................................................................... 259 Connecting to the Data .......................................................................................... 260 Deploying Your Application to Mobile .................................................................. 263 Deploy InterBase ToGo, dbExpress Driver, and the Database File to Mobile .................................................................................................................................. 263 Modify Your Code to Connect to a Local Database File on Mobile ............ 266 Run Your Application on a Simulator or on a Mobile Device ............................ 268 Troubleshooting ......................................................................................................... 269 InterBase Issues ....................................................................................................... 269 Exception Handling Issues .................................................................................... 269 See Also ....................................................................................................................... 270 Mobile Tutorial: Using InterBase ToGo with FireDAC (iOS and Android) ............... 271 Using FireDAC to Connect to the Database ........................................................ 273 Design and Set Up the User Interface .................................................................... 273 Connecting to the Data .......................................................................................... 274 Deploying your Application to Mobile ................................................................... 278 Deploying InterBase ToGo Required Files and the Database File to Mobile278 Run Your Application on a Simulator or on a Mobile Device ............................ 283 Troubleshooting ......................................................................................................... 284 InterBase Issues ....................................................................................................... 284 Embarcadero Technologies 8 Exception Handling Issues .................................................................................... 284 See Also ....................................................................................................................... 285 Mobile Tutorial: Using dbExpress and SQLite (iOS and Android) ........................... 286 Using dbExpress to Connect to the Database ..................................................... 287 Creating the Database in the Windows Environment for Development Purposes ...................................................................................................................... 287 Create the Database in the Data Explorer ....................................................... 287 Create Table on DataExplorer ............................................................................ 289 Design and Set Up the User Interface .................................................................... 290 Connecting to the Data .......................................................................................... 291 Creating the Event Handler to Make the Delete Button Visible When the User Selects an Item from the List .................................................................................... 293 Creating the Event Handler for the Add Button to Add an Entry to the List .... 294 Creating the Event Handler for the Delete Button to Remove an Entry from the List ................................................................................................................................ 298 Setting Up Your Database Deployment for Mobile Platforms ............................ 300 Add and Configure Your Database File in the Deployment Manager ........ 300 Modifying Your Code to Connect to a Local Database File on Mobile Platforms ..................................................................................................................... 301 Specifying the Location of the SQLite Database on the Mobile Device ..... 301 Creating a Table if None Exists ............................................................................ 302 Running Your Application on a Mobile Device .................................................... 303 See Also ....................................................................................................................... 305 Mobile Tutorial: Using FireDAC and SQLite (iOS and Android)............................... 306 Using FireDAC to Connect to the Database ........................................................ 307 Creating the Database using FireDAC framework .............................................. 307 Design and Set Up the User Interface .................................................................... 309 Using the LiveBindings Wizard .................................................................................. 311 Add the LiveBinding components ...................................................................... 311 Connecting to the Data ....................................................................................... 313 Displaying ShopItem in the ListView .................................................................... 315 Creating the Event Handler to Make the Delete Button Visible When the User Selects an Item from the List .................................................................................... 315 Creating the Event Handler for the Add Button to Add an Entry to the List .... 316 Creating the Event Handler for the Delete Button to Remove an Entry from the List ................................................................................................................................ 320 Preparing Your Application for Run Time ............................................................... 322 Setting Up Your Database Deployment for mobile ............................................. 322 Add and Configure Your Database File in the Deployment Manager ........ 322 Modifying Your Code to Connect to a Local Database File on mobile .......... 323 Specifying the Location of the SQLite Database on the Mobile Device ..... 323 Creating a Table if None Exists ............................................................................ 324 Running Your Application on a Simulator or on a Mobile Device ..................... 325 See Also ....................................................................................................................... 326 Embarcadero Technologies 9 Mobile Tutorial: Connecting to an Enterprise Database from a Mobile Client (iOS and Android) ................................................................................................................. 327 Creating the Middle Tier, a DataSnap Server ....................................................... 328 Create a DataSnap Server VCL Application .................................................... 328 Define a DataSet on the DataSnap Server ....................................................... 330 Expose the DataSet from the DataSnap Server ............................................... 332 Run the DataSnap Server ..................................................................................... 333 Creating a Mobile Application that Connects to the DataSnap Server ......... 334 Deploy the MIDAS Library to iOS Simulator ........................................................... 337 Run Your Application on the mobile platform ...................................................... 337 See Also ....................................................................................................................... 338 Mobile Tutorial: Using FireDAC in Mobile Applications (iOS and Android) .......... 339 Using FireDAC to Connect to the Database ........................................................ 339 Design and Set Up the User Interface .................................................................... 340 Using the LiveBindings Wizard .................................................................................. 341 Add the LiveBinding components ...................................................................... 341 Add the ListView component .............................................................................. 343 Using the LiveBindings Wizard .................................................................................. 345 Preparing Your Application for Run Time ............................................................... 346 Setting Up Your Database Deployment for mobile ............................................. 346 Add and Configure Your Database File in the Deployment Manager ........ 346 Modifying Your Code to Connect to a Local Database File on Mobile .......... 347 Specifying the Location of the SQLite Database on the Mobile Device ..... 347 Running Your Application on the Simulator or on the Mobile Device .............. 349 See Also ....................................................................................................................... 349 Mobile Tutorials: Table of Components Used ........................................................... 350 Embarcadero Technologies 10

Description:
Delphi®, ER/Studio®, JBuilder® and Rapid SQL®. Founded in . Add an SDK to the Development System for the iOS Device Connected to the Mac .
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.