Mobile Code Snippets
Go Up to iOS Mobile Application Development
The Appmethod Welcome Page lists the Mobile Code Snippets and provides the URL of the SourceForge code repository, as well as short videos to illustrate the code snippets. The Welcome Page contains separate tabs of mobile code snippets for iOS Getting Started and for Android Getting Started.
The Mobile Code Snippets are short, targeted samples that help you understand how to implement basic mobile functionality using Object Pascal.
Installed Location of the Mobile Code Snippets Projects
The Mobile Code Snippets are delivered in the following folders in your product installation:
C:\Users\Public\Documents\Embarcadero\Studio\14.0\Samples\Object Pascal\Mobile Snippets
Each Mobile Code Snippets folder contains the files for one or more Appmethod projects: that is, the project files, source code, form files, and an Information.txt file (a readme file) for each snippet project.
Use either of these two paths:
- Start | Programs | Appmethod 1.14 | Samples (then select the Mobile Snippets folder)
- C:\Users\Public\Documents\Embarcadero\Studio\14.0\Samples\Object Pascal\Mobile Snippets
Downloading the Latest Source Code from SourceForge
To obtain the latest changes, you can download the code for the Mobile Code Snippets from the Subversion repository on SourceForge in several different ways. Two of the most common ways are described here.
Using the Subversion Commands in the IDE (Recommended)
In Appmethod, right-click a Mobile Code Snippet source file in the Project Manager and choose a Subversion command from the context menu:
- ★ Commit - to commit your local changes to the project in the SourceForge repository
- Commit is only available to users who have read/write permission on the SourceForge Appmethod repository.
- ★ Update - to download the latest code changes from SourceForge to your local copy
- Anyone can update their samples and mobile code snippets from SourceForge.
- ★ Browse repository - to open a browser to view and navigate the SourceForge repository
- Anyone can browse the SourceForge repository.
Using the Source Forge Browser Interface
The Source Forge Appmethod site is available here:
To download the latest source code for the Mobile Code Snippets, use either of these two procedures:
- Download the entire set of Appmethod samples and the Mobile Code Snippets:
- Navigate to the code snippet of your choice, here:
- Click the Download Snapshot link.
- Download an individual file:
- In the \Mobile Snippets branch (see step 1 in the previous procedure), navigate to the snippet you want, and click Browse Code.
- Click the file name, review the code onscreen, and select Download this file.
To see commit information for each file in a project, click History and then Tree.
Mobile Code Snippets List
|Code Snippet||Shows You How to ...|
|Accelerometer||Use the accelerometer sensor to obtain information about the device acceleration, angular acceleration, motion, and speed.|
|AccessCameraApp|| Use standard actions to open the Camera Application on your mobile device, take a picture and retrieve the taken image for display on your FireMonkey form.
|AudioRecPlay||Record audio (sound) using the device microphone and then play the sound back using the device speakers or headphones.|
|| Manipulate the camera on your mobile device, and select either the front-facing camera or the back-facing camera. You can also select whether to use the flash (always on, automatic, or off).
|CameraRoll|| Use standard actions to open the Photo Library on your mobile device and retrieve an image from the library for display on your FireMonkey form.
|CustomPicker|| Use the TComboBox component to pick an item from the combobox and display the item's Text on a label.
|DatePicker|| Use the TDateEdit component to pick dates and process them to use in your FireMonkey applications.
|DeviceInfo||Obtain device information that includes OS version, OS name, and device type.|
|FireDAC_IBLite||Populate a listview from an IBLite database using FireDAC and LiveBindings.|
|FireDACSQLite||Populate a listbox from an SQLite database using FireDAC and LiveBindings.|
|Gyroscope||Use the Gyroscope to rotate a 3D cube when the mobile device is tilted.|
|HorizontalScroll||Use the THorzScrollBox component to scroll through two identical pictures.|
|IBLite|| Populate a list box from an InterBaseLite database using LiveBindings.
|| Three separate code snippets that demonstrate how to:
|Location|| Use the TLocationSensor component in order to read the GPS location of the device and display it realtime on the form. The snippet also shows you how to use Google Maps in order to accurately pinpoint the location of the device on a real map.
|MessageAlerts||Pop up various alert messages, both standard one-button information box style, and multiple button input box styles that allow various confirmations.|
|| Two separate code snippets that demonstrate how to:
|OrientationSensor||Use the TOrientationSensor component to get various compass-related information such as three-axis tilt, distance and heading, heading relative to magnetic north compensated and uncompensated, and heading relative to true north compensated and uncompensated.|
|PhoneDialer||Use the PhoneDialer API to make a phone call and to obtain the carrier information.|
|PlayAudioFile||Use TMediaPlayer and include an audio file for playback on your mobile device.|
|ShareSheet|| Use standard actions to open the Camera Application on your mobile device, take a picture and retrieve the taken image for display on your FireMonkey form. Then with another standard action, open the sharing sheet in order to share that image with other services.
|TabSliding|| Use a TabControl with TabPosition set to Dots to enable scrolling of tab items on mobile devices. The application has two tab items, each containing a different image.
|TimePicker|| Use the TTimeEdit component to pick dates and process them to use in your FireMonkey applications.
|VideoPlayback||Play an existing video clip on your iOS or Android mobile device.|
|WebBrowser|| Use a TWebBrowser component on a mobile device. The application consists of an edit box, a button, and the web browser component. Type an address in the edit box and press the "GO" button to redirect the browser to your address.