Categories
Android Delphi Projects Mobile News REST

Hello Google Glass from Delphi XE5

Google’s new Glass platform is a very revolutionary Android device, but the question I really wanted to know is if I could develop for it with Delphi XE5. Turns out the answer is Yes.

There are actually two different options for developing Glassware: Mirror API and GDK.

The first is the Google Mirror API, which allows you to build services, called Glassware, that interact with Google Glass. It provides this functionality over a cloud-based API and does not require running code on Glass. This is accomplished through a REST and JSON based API. Thanks to the new TRESTClient components in Delphi XE5 this should be easy enough to do.

The GDK on the other hand is the avenue where you build an actual APK that runs on the Google Glass device itself. This gives you the most access to the device, its sensors and features. Turns out this is also easy enough to do with Delphi XE5.

The actual GDK builds on top of the Android SDK. You can develop apps to run on Glass with either the Android SDK or GDK, but the GDK is necessary to take advantage of some of the Glass specific features.

If you run SysCheck on Glass (which takes some effort) you discover it has an ARMv7 PRocessor rev 3 (v71) with Android OS Version 4.0.4 and NEON support. Those meet the main requirements for Delphi XE5 development. So I created a simple Hello World app and ran it.

This first screenshot shows Glass appearing in the Project Manager as a valid target (once the required USB drivers were installed, which was tricky for glass).

HelloGlassProjectManager

Here is a screenshot of the app running on Glass

Delphi XE5 App running on Google Glass

I didn’t hide the status bar, which most Glassware does, and it does nothing other than serve the purpose of showing a Delphi XE5 app running on Google Glass. There were no special settings (other than the dark theme, which is a matter of taste) to make the app run on Glass. It just works.

And lastly a quick selfie of me and Glass, taken through glass.

JimWithGlass

I was hoping it would look more red than orange, but should have known Tangerine would be orange.

Rest assured, there will be more coverage of Delphi and Glass. We are just getting warmed up. This app was not using the GDK (which is still in Beta) but it is an actual Delphi app running on Glass. What an exciting day!

Categories
Delphi Projects REST Source Code

Delphi XE5 Mobile REST Client Demo Source

With the release of Delphi XE5 I’ve made the source of the Mobile REST Client Demo available. This is a really super simple demo of the Mobile REST Client in XE5. It is designed to show up how you can consume a JSON REST Service and adapt it into a DataSet and then bind that to the UI. If you change the data source you will probably need to change the live binding.

I’ve changed the demo from the one I used in the video to consume an OData data source. OData is a new standard backed by Microsoft for sharing data over the web. You can think of it as SQL for the web. It is a combination of other technologies, including REST, AtomPub, and JSON. Sybase supports OData on all of their databases now, as does Microsoft and others.

The change was simply a matter of pointing it to the Northwind OData endpoint provided on Odata.org. The binding is setup to show the company name in the listview. I added the ability to specify a Root Element, but that isn’t necessary for the demo.

This new technology works in both desktop and mobile, FireMonkey and VCL. It should also work in C++ Builder.

[Download the demo] (MobileRestXE5.7z 8 KB – Requires Delphi XE5 – Builds for iOS, Android or Win32)

Categories
News

MonkeyMixer updated for Delphi XE5

Delphi MVP and my friend Simon Stuart just updated his MonkeyMixer utility for XE5 (in addition to XE2, XE3 and XE4).

Once installed (and you’ll need to close the IDE before installing, by the way) you’ll be able to right-click on any VCL or FMX project in the Project Manager to toggle the project between VCL and FMX.
You do this by clicking Switch Project to FireMonkey or Switch Project to VCL(depending on what the project type is at that time).

Download the latest version. (Updated for XE6)

Keep in mind mixing FireMonkey and VCL forms in the same application isn’t officially supported, but this is a good option for migrating a VCL application to FireMonkey, or just including exactly the features you need.

Link to Simon’s post.

Categories
Delphi Projects News Source Code

Android Screen View

Android Screen View UI

People have asked for a copy of the utility I wrote to view the attached Android device on the screen. It uses the built in screencap functionality of Android and the ADB (Android Debug Bridge) to grab and display a series of screenshots. It requires the Android SDK installed and does not require a rooted device.

The speed of update has to do with the screen resolution and image complexity. Simple screens (text and controls) update about twice a second. More complex screens (pictures, graphics, etc.) are slower than that.

For best results, turn on “Show Touches” under debug options.

It also supports saving a PNG to file.

Get the source: https://code.google.com/p/android-screenview/

Download the build: http://delphi.org/downloads/AndroidScreenView.7z

There are a few pending features that I just haven’t gotten to. If you’d like to contribute let me know. Thanks to Stephen Ball for all his contributions already!

Categories
News

GExperts for XE5 Experimental Build

My good friend and Delphi MVP Jeroen Pluimers has just posted an experimental build of GExperts for XE5. He is working with Erik Berry to get an official build up on the GExperts site.

GExperts is a collection of open source productivity enhancements for Delphi.

[Download Experimental Build]

Categories
Source Code

Mobile Location on iOS and Android

Most Android and iOS devices either include a GPS antenna, the ability to triangulate off cellular or wireless access points, or some combination. Accessing the location is different when using the platform APIs for iOS and Android. Luckily Delphi XE5 includes the TLocationSensor component. When activated it has a OnLocationChanged event which fired when the location changes more than the specified distance. In there simply examine the NewLocation.Latitude and NewLocation.Longitude to know the current location.

Learn more about multi-device, true-native app development with Delphi XE5 and check out other Mobile Code Snippets.

Categories
Article

Tips for Solving Bugs

Ars Technica has compiled some tips for solving bugs quicker from a question on Programmers Stack Exchange. Here are the highlights:

  • Break out the notebook – keep a log of your progress and methodology
  • Look for patterns and use the right tools for the job.
  • Self-reflection time – a non-technical approach.
  • Read and apply Working Effectively with Legacy Code

Danny Thorpe, former Borland Chief Scientist, had a conference session on Reading Tea Leaves: The Fine Art of Debugging. Luckily Joe White took some great notes, and Danny revisited some of his tips in another Stack Overflow answer.

I’m curious what tips and techniques you have for solving bugs, especially those really nasty ones. Are there specific tools your use? I know there is a lot of functionality in the Delphi debugger, much of which is rarely used to its fullest potential.

Categories
News REST

Delphi XE5 Mobile REST Client Demo

Short demo of the new TRESTClient on a mobile Android application with Delphi XE5. It consumes a JSON REST service and uses the TRESTResponseDataSetAdapter to adapt it into a TClientDataSet. The TRESTClient components are new in Delphi XE5 and work everywhere Delphi does: Windows, Mac OS X, iOS and Android.

Learn more about multi-device, true-native app development with Delphi XE5.

Get the source code.

Categories
News

Sneak Peek of Delphi XE5: Android DataSnap

Quick demo of a DataSnap client on Android with a preview of Delphi XE5. Shows how easy it is to visually bind your data with design time preview, and how easy it is to move your mobile database client app from iOS to Android.

Learn more about Delphi for Android

Categories
News

Sneak Peek: Delphi FirePhoto app on Android

Demo of using the FirePhoto app to take a picture with both the front and back facing cameras on the new Google Nexus 7. Also applying a built in GPU effect to the picture.

Learn more about Delphi for Android