All posts by admin

Opening a PDF on Android with Delphi

Intents on Android using API 26 to open PDF documents.

Recently, the Google Play store updated its requirements so the target API level of 26 was used to get new apps submitted. While this was reasonably easy to achieve through updating the AndroidManifest.Template, the change to the newer API changed the behaviour of my application.

Before the update, I would download a file to the CachePath and then share to a public folder. I would then get a URI for the public folder path file and share via Intents.  Following the update, this no longer worked. After a little research, I discovered this was due to the changes in the Android security system, that actually, make a lot of sense. Rather than sharing the file outside the application, you now provide tempory access to it via the Intent. To achieve this, you need to setup a Provider, (this is done via XML) and then programmatically provide the path as a ‘content://’ URI, set flags for allowing read / write access via the intent and share it.

The video shows how to achieve this and demo’s the working code. To help, below are some of the XML blocks you will need upon the way.

Adding Provider

Add this to the AndroidManifest.template in the source code root folder, before the </application> tag. This is then used to build all Android apps.

<provider android:name="android.support.v4.content.FileProvider"
android:authorities="%package%.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/fileprovider" />
</provider>

Provider file

Create a fileprovider.xml (or whatever file name you set in android:resource when declaring the provider).

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<cache-path name="bbresources" path="bbresources/"/>
</paths>

More flags and details for Provider Files can be found on the Android documentation

InterBase ToGo Android Update

InterBase ToGo Update for Android

Following an update to OpenSSL to address some identified vulnerabilities, Google has stopped allowing submission of applications that contain certain versions of OpenSSL libraries.

While InterBase ToGo and IBLite are not affected by the vulnerabilities identified, the current build that is shipped with RAD Studio for Android is being stopped from deploying to the Play Store. To get around this issue, please download the latest build for InterBase ToGo and replace the .a file in your local deployment files.

While tested on 10.1 Berlin, this download should work for any RAD Studio customer who’s product shipped contained InterBase XE7 (XE7, XE8, 10.0 Seattle and 10.1 Berlin).

Download the latest Android InterBase ToGo from Code Central

http://cc.embarcadero.com/item/30630

Where to put the file?

The InterBase ToGo library for IBLite and InterBase ToGo is the same file. This is typically found at

  • C:\Users\Public\Documents\Embarcadero\Interbase\redist\InterBaseXE7\android

You may also need to check for

    • C:\Program Files (x86)\Embarcadero\Studio\18.0\lib\android\Debug\
    • C:\Program Files (x86)\Embarcadero\Studio\18.0\lib\android\Release\

DocWiki notes

A few more notes about the reported case on this are available on DocWiki

http://docwiki.embarcadero.com/PlatformStatus/en/Main_Page#Hotfix_for_InterBase_on_Android

LiveBindings for VCL Developers – Webinar!

LiveBindings for VCL Developers [Webinar]

Visual LiveBindings is a technology that allows you to bind your data and objects (model) to the UI making. While LiveBindings is a key part of FireMonkey development, it is often overlooked by VCL developers.

A while ago I started a series of blogs on LiveBindings and how to use them with existing VCL applications. Covering seven blog posts, I looked at

  1. LiveBinding to DataSets
  2. LiveBinding to Objects
  3. Creating LiveBindings via Code
  4. Master Detail relationships (and objects as properties)
  5. Advanced Master Detail Relationships
  6. Mashing up Master Detail on different sources
  7. Helpful classes for LiveBindings

Following a high amount of demand and questions, you now have you chance to see me present live on this topic and ask your LiveBindings questions. Join me on Wednesday 31st August at 10am GMT.

Register now via community.embarcadero.com

The webinar will be followed by the live Q&A session.