Posts tagged " Android "

Activating Mobile Support in 10.2.3 Professional

July 3rd, 2018 Posted by Embarcadero No Comment yet

As you might be aware, with Delphi and C++Builder 10.2.3 Embarcadero added mobile support into the Professional edition. Previously it was available as a paid add-on.

In future releases I expect it’ll just be included as part of the normal Pro installation, but until then 10.2.3 Pro users need to take some extra steps to enable iOS and Android support: (more…)

Open files in external apps from Firemonkey

May 9th, 2018 Posted by Embarcadero, Mobile No Comment yet

It’s rather a common scenario when a Firemonkey mobile app needs to open a file. It might be a PDF document, an image or video. And while opening a file directly inside of Firemonkey app is totally a legit strategy, sometimes it may be not so easy to implement. TImage provides great support for various graphics formats, but what about PDF? Implementing PDF support for multiple platforms may be quite a challenge. Luckily, both iOS and Android provides a shortcut, we can ask OS to open a document in a third-party application of user’s choice.

And beyond that, mobile OS usually provides more options than just “open a file”. We can also share or print a file, which may be useful for users. (more…)

Internet connectivity state management in Firemonkey

April 12th, 2018 Posted by Embarcadero, Mobile 2 comments

It’s a common task for a Firemonkey developer to check Internet connectivity. It might be useful to notify a user that he is going to download a huge amount of data using his mobile connection, or just indicate Online/Offline mode on the UI.

This functionality is missing from RAD Studio classes, so lots of developers out there have made solutions for their needs, although most of them only solve problems of their developer and may not fulfill your needs.

In order to fill that gap I made a solution which follows these guidelines:

  • Android and iOS support
  • ability to retrieve current Internet connectivity state – disconnected, connected to WiFi, connected to mobile data
  • Internet connectivity state listener which fires every time when connectivity changes
  • a cross-platform interface with encapsulated platform-specific solutions

(more…)

Push Notifications and Aggressive Power Management on Android

February 20th, 2018 Posted by Embarcadero, Mobile No Comment yet

If you’ve done much mobile development, you’ll know that what happens to your app when you switch away from it is very much at the mercy of the OS. While this is true on the desktop and the server as well, on mobile the OS is very focussed on maximising battery life, and so will be much more restrictive about background activity.

For the most part this is not such a big problem, once you’re aware of it. Pawel wrote an article awhile ago about responding to app lifecycle events, so that you can know when the OS is about to put your app to sleep, wake it back up again, etc. You can also create Services on Android to have longer running processes that survive separately to the app. And of course, this is why we have Push Notifications, so that the OS can start the correct application when it receives a notification, even if that application is not currently running.

Or at least that’s how it’s meant to work. (more…)

Parallel (mis)Adventures

August 18th, 2017 Posted by Embarcadero 5 comments

In one of our customer projects, we had an Android app that was receiving broadcasts on a background thread (I’ll call this the Receiver thread). On receipt of a message, the Receiver thread needed to do some processing on that message and then update the main thread (the UI thread).

The initial solution to this was pretty simple, call TThread.Synchronize from the Receiver thread, passing in an anonymous method that updates the UI Thread.

Testing this on Windows worked fine, however running it on Android revealed a problem. (more…)

Logging in Android

July 6th, 2017 Posted by Embarcadero, Mobile 4 comments

RAD Studio’s ability to do remote debugging of Android apps on device is fantastic for tracking down issues. However sometimes you have issues where the debugger can’t help. Case in point is one of the projects we were doing for a customer recently. The Android portion included a Service, which needed to be auto-started when the Android device booted. It worked fine if it was started manually, but auto-starting at boot resulted in a  crash. We couldn’t use the RAD Studio debugger as it was all over so quickly at boot time. Fortunately we were already logging messages out to the Android logs from within our app, so we were able to track down the problem. How?

Let’s go through the two necessary pieces:

  • Logging a Message
  • Viewing the Android log

(more…)

Hey RAD Studio 10.2 Tokyo, where’s my adb.exe?

June 28th, 2017 Posted by Embarcadero, Mobile No Comment yet

The RAD Studio installer has been significantly improved over recent releases. One of the newer features is the ability to quickly add and remove Supported Platforms to your installation from within the IDE (see the Tools | Manage Platforms menu in the IDE). The same utility also lets you install other items, like bundled 3rd party tools, other language support and also the Android SDK.

 

However, if you do all of those things, you might be a little puzzled as to why it looks like the Android SDK Tools have not been installed. For example, if you go looking for adb.exe you won’t find it. Search the whole hard drive, it’s just not there. (more…)

Which Keystore was used to sign this Android App?

October 13th, 2016 Posted by Embarcadero, Mobile No Comment yet

Recently we were doing some work on an existing RAD Studio Android app for a customer. Their previous developer had let them down so they’d brought it to us to do the next version.

Everything went smoothly until we needed to do an AppStore build. As part of this, you need to specify a keystore file that will be used to sign the APK. Fortunately they had the keystore file and password that the previous Developer had used. Unfortunately, they had two keystore files, and didn’t know which one had been used for the prior version.

This matters a lot, because if we used a different one, the Google Play store would view this as a brand new app, and not an updated version of the old app. That means their current users would not be prompted to download an update, and they would instead have to somehow get them to all uninstall the old one and install the new one. (more…)