This tutorial shows you how to deploy and access files and/or folders containing files in your iOS and Android apps. To accomplish this, you create a new mobile app, a few lines of Object Pascal code, use the Project | Deployment menu item and use the System.IOUtils unit's TPath.GetDocumentsPath method and PathDelim in your code.
The steps to create the mobile app
1) use the File->New ->Mobile Application main menu item and select the "Blank Application" project template.
2) On the form, add 1 TButton, 2 TLabel and 1 TImage components.
3) Double click on the TButton component to create the Button's OnClick event handler.
5) Add the following Object Pascal code in the event handler to display the documents path and to load the bitmap from the documents folder:
procedure TForm1.Button1Click(Sender: TObject); begin DocPathLabel.Text := TPath.GetDocumentsPath; Image1.Bitmap.LoadFromFile(TPath.GetDocumentsPath + PathDelim + 'davidi_tiedye.jpg'); end;
6) In the Project Manager, select each of the Android and iOS Target Platforms to active each one to build an application for each one.
7) Use the Project | Deployment menu item and select the Android and the iOS Device platforms and for each one click the "Add Files" button in the local toolbar to select the bitmap file to deploy with the app and set the Remote Path column value for each platform.
- For Android, set the Remote Path to .\assets\internal
- For iOS, set the Remote Path to StartUp\Documents
Here are screen shots of each of the resulting Deployment settings:
8) Compile, Deploy and Run the app for Android (I used my Samsung Galaxy S4) and iOS (I used my iPhone 4s)
You can read additional information about mobile application development and deployment on the Appmethod DocWiki using the following URLs: