Categories
10.3 Rio Android News webinar

Get the Most out of Android with 10.3 Rio

Today, I have a webinar on Getting the Most out of Android with 10.3 Rio. I want it to be a bit of a State of Android development today, as well as a What’s New in 10.3 Rio for Android. During CodeRage 2018 presented on what’s new in 10.3 Rio around Android. That session evolved into this webinar.

You can access the slides directly too.


Here is the Q&A log. I’ve gone back and typed answers to all the questions and included links too when possible. I may have edited some questions for length or clarity. The recording of the Q&A failed, and despite trying to recover it I wasn’t able to.

  • Question: what about Samsung Tizen os mobile? I think it’s different than Android OS
  • Answer:
    • When I worked for a large PC manufacturer, it was common for companies to tell Intel they were looking at AMD CPUs as a bargaining technique
    • Samsung mostly uses Tizen as a way to tell Google that they have options aren’t too attached to Android
    • Abandoning Android compatibility and ecosystem is dangerous
  • Question: and what about Android Intel processors or Android emulator with Intel Atom (x86)
  • Answer:
    • Intel’s Atom processors made a short appearance in Android devices 
    • They were x86 instead of ARM base 
    • Android 4.4 KitKat included libHoudini to provide ARM compatibility 
    • ARM compatibility was required because of widespread native NDK apps 
    • Most games include native NDK parts 
    • Discontinued for Android in 2016
  • Question: 8.1 Oreo not yet available for S8+
    • Answer: That is unfortunate, I thought it was. I recently read that Android 9.0 Pie is coming.
  • Question: In case I need an external Android library (jar file) included in my project, what should I do?
    • Answer: Check out the DocWiki for information. But you can add the JAR file in the Project Manager under Targets -> Android -> Libraries and then use Java2OP to create a JNI Bridge file. There is good information in the DocWiki
  • Question: Will there be the same webinar for iOS?
    • Answer: Maybe. I’m not as familiar with iOS, but I’ll see what I can do.
  • Question: Just a Note that Huawei also has a Dex equivalent and it seems to work better than Samsung’s. Please don’t ignore that
    • Answer: Very cool! It looks like it called EMUI Desktop on their HUAWEI Mate 10
  • Question: I am trying to use Drag and Drop to re-sequence TListView items and cannot find any relevant examples. (only things moving panels etc). how would I go about this?
    • Answer: I’ve not tried, but I’ve seen it done. I would treat the ListView items as individual items like panels and then drag those. On drop just look at where it as in the list and change the index.
  • Question: LivePreview are available somehow for Delphi CE?
  • Answer: Yes, just build it and install it. You can find the source here 
    • C:\Program Files (x86)\Embarcadero\Studio\20.0\source\Tools\FireUIAppPreview\
    • and more information on using it DocWiki
  • Question: Are there examples of how to make accepting permissions and explain why needed?
    • Answer: In the DocWiki and I covered it in the webinar.
  • Question: Receiving “Can’t open socket: Permission denied. Exiting” message when trying to debug an Android app. Running Android 8.0. This has been a problem since 10.2.
    • Answer: I just tested this with Rio and a Note 9 running Oreo 8.1 and it worked fine. There was a bug in Android 8.0 that impacted all debuggers. You can find more information on Marco’s blog post.
  • Question: Why does Delphi take so long, literally 5+ minutes, to recognize an Android device connected, via USB, to my laptop? Windows recognizes the device immediately and I’m able to browse the device within Windows file explorer. Clicking the refresh devices button has no effect. Is there a way to speed up this device recognition process?
    • Answer: Odd. I’ve not seen that. If you run ADB DEVICES from the command line does it recognize it? If not then that would be an issue with the Android Debug Bridge (ADB) so could be related to your device or the ADB USB driver. The single physical device has multiple devices that Windows recognizes. One is the MTP device for transferring files, the other is the ADB device for debugging. So just because windows recognizes the MTP device doesn’t mean it has recognized the ADB device yet. What device is it?
  • Question: Re: Delay recognizing device: Device is a Samsung Galaxy S8+. Also tried an HTC One M7 with the same result.
    • Answer: Did you try ADB DEVICES from the command line? It could be a Windows issue.
  • Question: Re: Open Socket error: Android version 8.0. Device Samsung Galaxy S8+. Running Delphi Rio 10.3 So there’s no workaround? Given the current route that Android updates arrive at devices: Google -> Manufacturer -> Telcom -> Device means that I’m stuck with no debugging for potentially years … already been ~6 months? Debugging is the reason I’ve invested in Delphi.
    • Answer: That was a bug in 8.0 Oreo that was fixed in Android 8.1 – it wasn’t specific to Delphi. Unfortunately, we don’t have any control over the Android OS or what Samsung installs on their devices. Wish we did. 
  • Question: What’s the best way to end an Android app?
    • Answer: Best practice on Android is that you don’t close your app, but let the OS manage that. If you need to though, then just call Close on your main form like you would on another platform. You could also try Application.Terminate and Halt.
  • Question: Just want to say that this has been an excellent seminar. Thank you for putting it on.
    • Answer: My pleasure. Glad it is of value.
  • Question: what are the sound capabilities in RAD Studio for Android?
    • Answer: You can do quite a bit. Anything that Android supports (which is a lot). There is a media player component that comes with FireMonkey. Take a look at the 4 sample games in GetIt. They have music and sound effects if I recall correctly. The great thing about using FireMonkey is you can get the productivity of all the FireMonkey components, libraries, etc. and then when you need to you can reach down and access the Android APIs just like developers who don’t use FireMonkey.
  • Question: Wouldn’t it nice to have a component for permissions?
    • Answer: The PermisionService makes it really easy, but a component could be useful too I suppose.
  • Question: Where are we with 64 bit for Android? 
    • Answer: R&D is working on it and it is on the Roadmap for later 2019.
  • Question: Give them the coming end of GCM, any plans for built-in FCM components?
    • Answer: Good question. I’ll need to look into that. I know there are some free 3rd party libraries that do that.
  • Question: Hello. where find more info about splash screen? It not clear how to control it.
  • Question: I can’t find LivePreview App on Google Play Store? Does it still exist?
    • Answer: Not currently, but the source ships with the IDE and you can build it and install it yourself. You can find the source here 
    • C:\Program Files (x86)\Embarcadero\Studio\20.0\source\Tools\FireUIAppPreview
    • and more information on using it in the DocWiki
  • Question: is possible to active and android Delphi generated app on both and remain on background sending GPS updates? any sample?
    • Answer: No samples, but I believe people have done it. You would need to be concerned about the battery though. You might need to go directly to the Android GPS API. I would suggest researching Android services on the Android developer site. There are a lot of rules about them.
  • Question: Hello, I’m wondering why for demos all presenters use a mac? Is better have Delphi on a Mac laptop?
    • Answer: I prefer Windows, and most developers I know do too, but Apple requires you to have a Mac if you want to build for iOS, and since I need to demo for iOS too then it makes sense to have just one computer.
  • Question: Ok. It will be great a webinar about to setup Delphi on Mac !!!
    • Answer: There is a good guide in the DocWiki 
  • Question: Is Firebase supported on Rio? from Rad Server?
  • Question: What about GUI test automation for mobile Delphi projects? Is there finally something available for that?
  • Question: 
    • Does the HTTP client library cover all SSL related topics or is there a need for “raw” TCP SSL sockets? If yes, the HTTP client might not be of help.
    • Although Android still supports SSL (Indy libraries), what about the support for the Google libraries (boring SSL).
      • Answer: Check out the new HTTP Client library that was introduced in XE8 – it uses the platform libraries, but don’t know if it supports Google’s Boring SSL specifically
  • Question: Does Fire Monkey support right to left languages like Arabic and Hebrew?
    • Answer: Take a look at FMX RTL. Also, if a 3rd party can do it, then you can do it yourself too. But using their library will certainly make it easier.
  • Question: Huawei is pronounced “hwah way” 🙂
    • Answer: Thanks! I tried to research it, but I am not good at pronunciations. 
  • Question: Are improvements in FMX listed. For example, when saving a TBitmap by SaveToFile, it did not pop up in the media on Android in my previous version. I had to add this programmatically.
    • Answer: I believe it has to do with where you save it and what file format. Save it as a JPEG or PNG and try saving it in a shared location like TPath.GetSharedPicturesPath.
  • Question: No question, just a hint: someone asked for Ranorex and Android. There is documentation on ranorex.com
    • Answer: Cool
  • Question: Google just announced a few days ago “Starting August 1, 2019: All new apps and app updates that include native code are required to provide 64-bit versions in addition to 32-bit versions when publishing to Google Play.” Looks like our apps will be orphaned later this year without a 64-bit compiler – what is the ETA for a 64-bit android compiler?
    • Answer: The  Roadmap has 10.4.x with 64-bit Android planned for “mid-2019”
  • Question: When will we see more common UI features as components (ie. not having to do things manually), such as slide menus, for example.
    • Answer: Like the TMultiView? It is a great common UI component that was introduced in XE7
  • Question: Can the location sensor be used in an Android service now?
    • Answer: I personally haven’t tested it . . . You may need to research the Android platform limitations on using location services in the background because of battery consumption issues. 
  • Question: how can we handle the android permission requests?
    • Answer: It is covered in the DocWiki and here is a sample in the location samples folder
  • Question: Did I understand correctly that there is a C++ Builder community edition accessible and free for any non-commercial use? (i.e., creating apps for personal use and for open-source distributed apps?)
  • Question: Doesn’t RAD Studio (or C++ Builder) have its own emulator to “test” apps on *all* platforms in a more-or-less automatic way? (assuming that the emulation is faithful enough)
    • Answer: We used to offer a bundle deal with MacInCloud but it didn’t get enough use to justify continue it since most people use devices. You can use the Android emulator but it isn’t great, and there are services that let you test on devices in the cloud. Samsung offers one too specifically for their devices. I’ve also heard some people have good luck with using Bluestacks, but I haven’t tried it. There are a lot of options.
  • Question: Speaking of how iOS is so different and has such different nuances compared to Android…
    • Answer: There is a lot you can do with a complete multi-platform approach, but then there are specifics to each platform you can take advantage of. For example, your desktop has a larger screen, and more input and output options. A pure multi-device approach does a lot and makes you really productive, but then the great thing about Delphi, C++Builder, & FireMonkey is you can also take advantage of platform-specific features and APIs. Kind of a best of both worlds approach!
  • Question: Thanks!
    • Answer: welcome!
  • Question: but there is a lot of devices that still running 8.0! Even Samsung …
    • Answer: Yes, it is an unfortunate bug in Android 8.0. Samsung says they have an update coming, and I hear the beta is already available. Have you tried that?
  • Question: What about 64-bit on Android, iOS, and macOS?
    • Answer: iOS 64-bit has been available for a while, bot macOS (10.3.x) and Android 64-bit (10.4.x) are on the roadmap for release this year. 
  • Question: what is the best way for FireMonkey mobile app to work with DB (on a server). REST or FireDAC? Or something else?
  • Answer: 
    • The best way depends on your goals and the scenario. 
    • I would recommend starting with RAD Server (EMS) using FireDAC to connect to the server database and then connect to RAD Server from your mobile app. 
    • You could also use DataSnap in the same situation (RAD Server is more of a turnkey, while DataSnap lets you build it from scratch so more flexible). 
    • If you don’t control the server then if the server is exposing the data over REST then you can use the REST Client libraries  or the BAAS libraries 
    • Although if it is on Azure or Amazon Cloud then use the cloud libraries 
    • You could also use DevArt’s UniDAC to connect directly to some databases from the mobile app
  • Question: Hello, what is the best way to show forms and destroy it for android application?
    • Answer: You can show and destroy forms just like you would on other platforms, or you might consider using frames on a Tab Control. Also, take a look at TFrameStand which is available in the GetIt package manager
  • Question: Is C++Builder Community Edition available for macOS?
    • Answer: Yes, it can target macOS. The same features as C++Builder Professional
  • Question: Is the size of the executable file for Android, prepared in FireMonkey still a problem?
    • Answer: It never was a problem. A “hello world” app in FireMonkey is larger than an equivalent app in Java because FireMonkey is including a lot of other additional libraries and features for building more complicated apps. There is a lot you can do to make a FireMonkey app smaller, but you give up functionality. If you look at real apps you will see that a Java based app and a FireMonky based app are much closer to the same size.
    • Take a look at this Anatomy diagram for more information. 
Anatomy Of A Delphi 10.3 Rio FireMonkey App from FMXExpress.com?
Anatomy Of A Delphi 10.3 Rio FireMonkey App from FMXExpress.com
  • Question: When will there be support for 64 bit Android?
    • Answer:It is on the roadmap for 10.4.x this year (2019) 
  • Question: Jim: When will Update 1 be available for Rio?
    • Answer: When it is ready. I expect it will be soon, but I can’t say specifically when.
  • Question: What are the critical target versions that should be tested?
    • Answer: All of them? 😉
    • You should be testing on Oreo 8.1 (the target SDK version) and probably Marshmallow (the minimum SDK version) too.
    • You should test on as many devices and OS versions as you can.
    • Pay attention to the Version Distributions Dashboard on the Android site to see what versions are most popular  
    • You can also follow other sites like to see what versions and devices that are popular
    • It can also depend on your app and your user base. Maybe you are targeting a specific region or tablets.
    • Then select the targets that give you the largest coverage.
  • Question: Best Book for quick start to sophisticated Android apps?
  • Question: Timeline for support of WatchOS from Apple?
    • Answer: Both WatchOS and AppleTV require apps published to the app store are in an intermediate format that Apple hasn’t published. 
    • I believe you can still build apps to deploy directly the platform though. 
    • Those platforms are not on the roadmap.
  • Question: I received this from Google: Ensure that your app supports 64-bit devices. Does Rio support this?
    • Answer: 64-bit is on the roadmap for mid 2019 
  • Question: For a Delphi Windows application to access files on your Android phone connected via USB. See MTP13.zip
    • Answer:Useful. That is using the PortableDeviceApiLib Type Library, good idea. You could also do it via ADB if you enable debug mode on the device.
  • Question: Why don’t forms have an option to auto create?
  • Question: How to send SMS from an Android app?
    • Answer:Yes there is sample code online although I haven’t tested it and it may need to be updated.
  • Question: Is there a easy way to get some values from a record from a local website
  • Question: Please address how to read and write external files from/to the SD Card.
    • Answer: That isn’t something I was planning to cover, but I will test it and post to later.
  • Question: Is adding other android SDKs to 10.3 fixed – had a hard time with 10.2?
    • Answer: I’ll blog about it some more. It is pretty straight forward, but there are some details in the DocWiki 
  • Question: I miss the DBaware components from VCL in FMX. How can I get Design time data?

Here are some interesting statistics I originally didn’t include because of time . . .

Android � Logos Download
Android statistics and facts
  • 85% of the global mobile operating system market runs Android
    • 62% of US,  76.4% of China, & 25% Enterprise markets
  • 37.93% of all devices connected to the Internet
  • 70% of tablet market
  • 400+ manufacturers with 4000+ devices on 500 carriers
    • 600+ devices launched in 2015 alone
  • The average Android smartphone user
    • Touches smartphone 2,617 times a day
    • Has 95 apps installed, but only uses 35 apps daily  
    • Deletes unused apps after 12 weeks
  • 34% of US smartphones are by Samsung (running Android)

Android Statistics Sources: 

I pulled a couple of graphics from my presentation that I thought were interesting and that you are free to share. (Select an image for the larger version.)

Categories
10.3 Rio Android FireMonkey News

Android Z-Order, Native Controls, and 10.3 Rio

Z-order represents stacking controls
Z-order represents stacking controls

Before 10.3 Rio when you used a a platform-native control, like TWebBrowser or TMediaPlayer, you were not able to put other controls on top of them. That stacking of controls is knowns as Z-Order. This was especially annoying when you were using them with the TMultiView (one of my favorite controls), because the drawer would slide out under instead of over the platform-native control. There were ways around it, but it was still frustrating.

In XE7 we introduced the ControlType property for iOS, and then in Seattle we brought it to Windows. Setting it to Platform switches a FireMonkey control to a platform-native control at runtime.

Now with the upcoming 10.3 Rio release the ControlType property is coming to Android, and it is brining two significant benefits: More Native Controls, and corrected Z-Ordering.

More Android Native Controls

The TWebBrowser, TMediaPlayer, TBannerAd, and TMapView are always platform native controls (they are rendered by the underlying Android OS and not by FireMonkey.) But in 10.3 Rio there are 4 new controls that are optionally platform native.

TSwitch component

That means when you set the ControlType property on these controls they will be rendered by the Android system instead of FireMonkey. You may notice some slight changes in the way they look and work because of this.

This is especially important in the TEdit as there are certain behaviors that are attached to the way users provide keyboard input and edit text. Here are some of the advantages your users will now have when you use a ControlType of Platform with your TEdit

  • Auto-Correction: Words are suggested while typing, these can be used by clicking on the space bar.
  • Define: You can select a word and click on Define to see the definition of such word in the dictionary.
  • “.” Shortcut: Double tapping the space bar inserts a period followed by a space.
  • Text Shortcuts:? That will expand into the word or phrase as you type.

Some of these behaviors vary from one Android platform to others (for example Samsung has a Clipboard feature). You can configure these settings on your Android devices in Settings > General > Keyboard.

Native Aware Android Z-Ordering

Additionally many controls now are able to handle a Z-Order over a platform native control. Now you can put control buttons over your TMediaPlayer for example. These controls have a ControlType property that when you set it to Platform it will maintain the Z-Order with other platform-native controls.

Setting their ControlType to Platform doesn’t make these platform-native, it just makes them work correctly with other platform native controls.

What’s Next?

10.3 Rio is in beta (which means these features are subject to change) and available to update subscription customers. Once it is released you can learn more about all of these features in the DocWiki. Also, if you are already using Platform native ControlType on iOS or Windows then those control will take advantage of the Android Platform native ControlType right away!

Android Z-Order and the Native Controls - Coming soon to a RAD Studio 10.3 Rio Near you!