For more information on BaaS, check out Sarina’s excellent series of blog posts.
Author Archives: Jim McKeeth
I substituted for David I. yesterday for Developer Direct Mobile Summer School on Lesson 5: Connecting Mobile and Desktop together using App Tethering. The Summer School landing page and David’s blog maintain a list of downloads for all the previous lessons, but here are the resources from my session in the meantime.
I’ll post the replay videos here when they are available too.
You can download my slides and code samples from Code Central. I believe I fixed the issue where some people were not able to download it.
Here are the links to more information on App Tethering:
- Using App Tethering [Appmethod] [RAD Studio]
- Connecting [Appmethod] [RAD Studio]
- Sharing Data as Strings and Streams [Appmethod] [RAD Studio]
- Sharing and Running Actions [Appmethod] [RAD Studio]
Here is the Developer Skill Sprint I did previously on App Tethering
And this is Al Mannarino’s C++ Mobile Day session on the topic
And some blog posts on the topic too:
- David I blog – “Finding your Tethered Apps”
- Steffen Nyeland blog – “Fun with Delphi XE6 App tethering and barcodes”
- Sarina Dupont blog – “Extend your Windows apps to mobile with Tethering in XE6”
There was some interest in the code sample that bypasses App Tethering’s autodiscovery to connect directly to a specific IP address. I’m working on getting that tested before posting it. Leave a comment if you are interest and I’ll see that you are notified when it is ready.
For my Developer Skill Sprint I was originally scheduled to show how to do a Google Glass Voice Trigger. That is pretty cool because it allows you to launch a Google Glass app with your voice, but I decided to expand on that to also show how the Google Glass app can be launched with the results of additional voice input, as well as how to take dictation and do text to speech everywhere else in Android.
I’ve still got a lot of work to do on the components, but they work as is for now. If you want to modify the component code then take a look at my Skill Sprint and blog post on the Android JNI Bridge.
By creating a custom Classes.dex you can get access to 3rd party Java JAR APIs from your application. For my Integrate More Android with a JNI Call to your Android App Developer Skill Sprint I created a demo app that demonstrates creating a custom Classes.dex. This is a new feature in XE6 and Appmethod 1.14. [Download the demo] [Download the slides] The Demo app uses the Base64Coder JAR file (included). To build the demo:
- Examine the createdex.bat file to make sure it refers to the correct location for your dx.bat utility and the fmx.jar & android-support-v4.jar files.
- Run the createdex.bat file to create the classes.dex file which includes the two jar files above, plus the base64coder.jar file.
- Double check that the Deployment Manager references the new classes.dex and not the old ones, and that the remote path is “classes\”
- Notice that the android.JNI.Base64Coder.pas file wraps and exposes the methods of the base64coder class.
- Run the app on your Android device and verify that it works as expected.
The Base64Coder.JAR is Android specific, so it will not work on iOS or Windows. Some additional notes from the Developer Skill Sprint: Some useful units for making JNI calls
- Androidapi.Jni – Java Native Interface type definitions
- Androidapi.JNIBridge – The JNI Bridge
- Androidapi.JNI.JavaTypes – JString and other common types.
- Androidapi.Helpers – JStringToString and other useful conversions.
- FMX.Platform.Android– Useful platform methods like GetAndroidApp, MainActivity and ConvertPointToPixel
- Others useful units: Androidapi.AppGlue, Androidapi.JNIMarshal, Androidapi.JNI.Embarcadero
- For more see: C:\Program Files (x86)\Embarcadero\Studio\14.0\source\rtl\android (Object Pascal) and C:\Program Files (x86)\Embarcadero\Studio\14.0\include\android\rtl (C++)
You will want to make use of Conditional Defines in Object Pascal and Predefined Macros in C++. In my blog post on Android Settings I showed how to make a JNI call with Object Pascal, but you can also look at the DeviceInfo Mobile Code Snippet in both C++ and Object Pascal. To create your own JNI Bridge wrappers, look at the source code in C:\Program Files (x86)\Embarcadero\Studio\14.0\source\rtl\android (Object Pascal) and C:\Program Files (x86)\Embarcadero\Studio\14.0\include\android\rtl (C++). You can also consider the following 3rd party utilities:
- Java2Pas by Software Union
- JavaImport by WinSoft
- Android2DelphiImport by CHUA Chee Wee aka “Chewy” (also an Embarcadero MVP) [my previous review]
If you just want to include standard Android APIs then check out the FMXExpress (also an Embarcadero MVP) project on GitHub that includes all the Android APIs. Here is the video replay of my skill sprint
Also, check out Brian Long’s video on accessing the Android API with XE5
As part of the free Developer Skill Sprint on REST & JSON here are my slides and sample source code. Appmethod, RAD Studio, Delphi & C++Builder XE6 ship with the Desktop sample RESTDemos sample which includes examples for:
- Google Tasks
- Plus Some others
That includes both OAuth1 and OAuth2 usage. My Dropbox demo is a mobile app written in both C++ and Object Pascal. It uses OAuth2 and the mobile TWebBrowser to perform the authentication. You can view and download the slides as well. Useful links:
- DocWiki with Examples
- CodeRage 8 – Dive into Details of REST library
- CodeRage 8 – REST Library – Tool of Many Trades
- Blog Posts in C++
- Blog Posts in Object Pascal
So upgrade to XE6 or download the trial today.
I’m joining Nick Hodges in King of Prussia, Pennsylvania for the Philly.NET Code Camp 2014 Refactored. I’ll be showing off the latest version of Appmethod, including the Free Forever C++ for Android version. Astute readers may have noticed that my sessions are not on .NET, and the conference isn’t actually in Philadelphia. I’m guessing that is the “Refactored” part.
If you are in the area, stop by and say hi. They still have tickets for the two day event where you can catch all three of Nick and my sessions, and maybe a few others if you are interested.
Michael Feathers defines “legacy code” as “code that has no unit tests”. Without unit tests your code is fragile, hard to change, and unreliable. Unit testing is the only way that you can be sure that your code does what it is supposed to do.
This talk discusses the basics of Unit Testing by defining terms, discussing what Unit Testing is and is not, and talking about the best techniques and practices for writing unit tests.
All the demos will be in Delphi code, but the principles all remain the same: There no longer is an excuse for not writing unit tests.
I plan on finding a good authentic Philly Cheesesteak Sandwich while I’m there too!
FireMonkey offers a lot more alignment options than those offered in the VCL. The Alignment aligns the control within its parent, setting anchors, size and position. The Default is None. To make it easier to think about them, you can group the different types of alignments.
- Anchor and fill along edge – these are 4 of the alignments you are most likely familiar with.
- Top, Bottom, Left, Right
- Like the above, but takes precedence over other alignments
- MostBottom, MostTop, MostLeft, MostRight
- Fill parent, but preserve aspect ratio – very powerful, especially when applied to one of the new layouts, like the TScaledLayout.
- Fit, FitLeft, FitRight
- Resize only on one axis (width or height) to fill that axis of the parent and optionally centered
- Vertical, VertCenter, Horizontal, HorzCenter
- Client – Fills remaining space not occupied by other pinned controls.
- Contents – Fills entire client area of the parent overlapping other controls.
- Center – Just moves to the center without resizing.
- Scale – Maintains relative size and position relative to the parent as it resizes.
There are a lot of interesting Delphi projects showing up on GitHub. GitHub offers a convenient Download ZIP function, not to mention a very easy to use Windows Desktop Client that has full support for managing local repositories, syncing them to GitHub and accessing GitHub projects via Cloning in Desktop.
Sometimes it is nice to just open the project in your IDE of choice directly from GitHub. Turns out this is just as easy as 1-2-3. Right above the Clone in Desktop and Download ZIP buttons there is a checkout URL with support for Subversion. Simple click Subversion, then click copy URL and your can then open the GitHub project directly from the Delphi or RAD Studio IDE.
This maintains the revision history locally so you can browse it from the history tab, but it doesn’t appear to allow checking changes back in.
You probably want to update the SVN client RAD Studio uses. This is easy enough too. Just download and install the Colab SVN 32-bit Windows client (don’t get 64-bit or Edge) and install it normally. Then edit your Registry and browse to “HKEY_CURRENT_USER\Software\Embarcadero\BDS\14.0\Subversion” and add a string value named SvnDllDir. This value of SvnDllDir should be the path to your SVN client install. Something like “C:\Program Files (x86)\Subversion Client” (without the quotes).
If you don’t like the fact the Colab Subversion site requires a login, there are other sources for download the Subversion command-line client. Just be sure you get the 32-bit version since the IDE is 32-bit. You may have luck with with the command-line tools that come with TortoiseSVN, or I’ve tested it with the Command-line client from Assembla and found it worked fine.
New in XE6 is support for VCL Sensors. What better way to show these off then on the 8″ Dell Venue 8 Pro Windows 8.1 Tablet. The VCLSensors sample ships with RAD Studio XE6. I simply deployed it to the Dell Venue 8 Pro and it runs great.
I added one of the VCL Styles to it as well. You can see it running here with my favorite wallpaper. It shows the Latitude & Longitude from the GPS via the TLocationSensor, the motion from the accelerometer via the TMotionSensor and the compass heading + tilt from the compass and gyroscope via the TOrientationSensor.
These sensors behave exactly the same way as the FireMonkey mobile ones do on Android and iOS, but now you can take advantage of them with your desktop applications.
You can also use the Metropolis UI and the tablet optimized styles for a full screen tablet experience on the Dell tablet. Both with VCL and FireMonkey.
I took my code I previously used to control the Parrot AR.Drone and turned it into a reusable component. I added some more functionality to it as well, although there is a lot more to cover. The component is available on GitHub.
It should work with Delphi, C++Builder, Appmethod and RAD Studio on iOS, Android, Windows and OS X. I’d love to hear how it works for you and what you use it for!