Using Moto 360 in Delphi XE7

Source: Internet
Author: User

Hello Moto from Delphi XE7 (translated version)

I really like my Moto 360 watch. It looks great and also is an extension of my Android phone, and of course the most important question is how to make an application. Use only RAD Studio X7,delphi or C + + to design your app. thanks to the new Fireui multi-device design I can create a custom view of the UI to make the perfect user interface design breeze. Here are some details of my app, followed by downloading my samples and customizing the view.

The bottom line is, it's just work, and it's really not a surprise. the latest Android devices use the ARMV7 and neon instruction sets. (Neon is a multimedia standard similar to those on Intel platforms.) first of all, not everyone uses these instructions, but once they do, everyone does. Therefore, Moto 360 is not surprising. Unlike some other watches, Moto 360 does not have a micro USB port. so you have to use ADB bluetooth. this takes some extra steps to install, which is really slow to deploy in. so I canceled the first deployment slowly because I thought I had something wrong.

First, the Moto 360 display is not entirely round. it has a flat area at the bottom. If you look closely, you can see that the light sensor has. Do not know why it is not round, or if there is a design reason. In any case, the screen has a resolution of 290 pixels per inch of 213 pixels. This means that at design time you have a usable area of x 218 pixels. This is the information we need to create a custom view. Put the following code in the package.
12345 TDeviceinfo.AddDevice(TDeviceinfo.TDeviceClass.Tablet, ViewName,  // The Moto360 is 320x290 phyiscal and 240x218 logical with 213 PPI  TSize.Create(320, 290), TSize.Create(240, 218),  TOSVersion.TPlatform.pfAndroid, 213,  True); // Exclusive

The device class enumeration actually has a watch class, but in the detection class at run time of the code, it does not know how to detect the watch. so it defaults to Tablet PC. XE7 was released prior to the launch of Moto 360, I imagine an update will solve this problem.

Getting a custom view showing the requirements in the IDE is a new perspective that you need to update in%appdata%roaming \embarcadero\ bds\ 15.0 \ Mobiledevices.xml Reference. on the mobile device component, add the following:

12345678910 <MobileDevice>  <Displayname>Moto360</Displayname>  <Name>Moto360</Name>  <DevicePlatform>3</DevicePlatform>  <FormFactor>2</FormFactor>  <Portrait Enabled="True" Width="240" Height="218" Top="102" Left="29" StatusbarHeight="0" StatusBarPos="0" Artwork="C:\Users\jim\Documents\Embarcadero\Studio\Projects\HelloMoto360\Moto360.png" />  <UpsideDown Enabled="False" Width="240" Height="218" Top="0" Left="0" StatusbarHeight="0" StatusBarPos="0" Artwork="" />  <LandscapeLeft Enabled="False" Width="240" Height="218" Top="0" Left="0" StatusbarHeight="0" StatusBarPos="0" Artwork="" />  <LandscapeRight Enabled="False" Width="240" Height="218" Top="0" Left="0" StatusbarHeight="0" StatusBarPos="0" Artwork="" /></MobileDevice>

you need to update the path to the correct location of the artwork point to the PNG on your system. or you can just leave it blank. Here's what it all looks like when installed in the IDE.

You'll notice the red circle on the design surface. I also see where the corner is (because the display is round). at run time, you can only see the red ones if you take a look. I will hide in the production run time. I put the text out of the box-1,-1, set the size to 242 x 242. such loops follow the circle rather than the screen display area.

    1. To make Moto 360 appear as a target device, you first need to enable Bluetooth debugging.

      1. Press the side key down until the Settings window appears, swipe down, and click on it.

    1. hold the side button in until , Settings  appears
    2. Swipe down to  about  and tap it .
    3. Tap on  build number  until It tells is a developer.
    4. Swipe settings and then tap on Developer options.
    5. Tap on  ADB debugging  until it says  Enabled .
    6. Tap on  Debug over Bluetooth  until it says  Enabled .
    7. on your paired phone, go to Android Wear settings (gears in the upper right)
    8. enable  debugging over Bluetooth .
      1. It should show
        • host:disconnected
        • target:connected
      2. target is the watch, Host is your computer.

Then your connect your phone that's connected to the Moto via USB and run the following commands (assuming ADB are on Y Our system path) to connect via Bluetooth. I made a batch file.

@echo off rem Optional cleaning up adb disconnect localhost:4444 adb-d forward--remove-all REM This is the connection ad B-d forward tcp:4444 localabstract:/adb-hub adb-d connect localhost:4444 REM These lines is to see if it worked echo He Re is the forwarded ports .... ADB forward--list Echo. Echo Wait a second for it to connect .... Pause ADB devices

The ADB Devices list should show something like

List of devices attached 123456ABCD device localhost:4444 device

Now the Android Wear app on your phone should show

    • host:connected
    • target:connected

Be sure this your Moto app uses the unit that defines the Moto mobile device (from your package). This is the your app can select it at runtime. If you don't have all that, you'll see something similar to this and it running on the Moto 360:

My camera had a hard time focusing in it, but rest assured it looks fabulous! I tried C + + too, and no surprises, it works as well. More experimenting to does, but it's nice to know I had a tool that would take me everywhere I want to go.

If you don't have a Moto-emulator, you can setup an Android (AVD) instead. I did so before mine showed up. You need to download the Android 4.4W (API20) SDK Platform and ARM System image.

Then create a AVD with the new Emulator.

It actually gives you the rectangle screens with a round bezel. Also It is the X (so completely round) and the PPI. This means the view I created (since it is exclusive) won ' t work on the emulator. You'll need to create a new custom view for the emulator, but I'll leave that up to.

You can download any of my code for the custom view, Bluetooth ADB batch file, and sample apps from Github. (Update: Added A view for Galaxy Gear Live & lg-g) BTW, XE7 adds local Git support, which is another great new feature. Download the trial and check it out.

Using Moto 360 in Delphi XE7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.