Hi guys, I'm trying to integrate an Android AppWidget (built in Android Studio) in to an Android Firemonkey application built using Delphi 10.1 (Berlin). All the widget has in its update function is a new RemoteView and then a setTextViewText on that view.

Hi guys, I'm trying to integrate an Android AppWidget (built in Android Studio) in to an Android Firemonkey application built using Delphi 10.1 (Berlin). All the widget has in its update function is a new RemoteView and then a setTextViewText on that view.

I've got to the point where I've managed to integrate the widget in to my Firemonkey app in Delphi, I can drop the widget from my deployed Delphi app on to the homescreen and it doesn't crash - but it also doesn't display the TextView text - nor does the LogCat give me an error to go off!

To get the widget integrated in to Delphi I created the widget as a library in a dummy app so I can lift the appwidget in to my Firemonkey app.

This deploys correctly from Android studio to the device. Then I followed this SO post to create a .jar file to drop in to my project libraries folder in the Delphi project...

https://stackoverflow.com/questions/21712714/how-to-make-a-jar-out-from-an-android-studio-project

Then I had to follow this article to ensure that the classes.dex file was generated correctly with the R.java and R$ classes files...

https://blog.grijjy.com/2017/01/30/embed-facebook-sdk-for-android-in-your-delphi-mobile-app-part-2/

After a lot of fettling with all that I'm at the point where the Delphi app deploys with the widget and you can drag the widget on to the homescreen, no crashes but also no text. This is the simplest case of widget I can use to prove out that I can embed a much more complicated widget in to another app in production.

After all that my question is - Are there any devs here who have successfully added a widget to a Delphi application using Delphi 10 and are there any resources you used to successfully migrate an appwidget built in Android Studio to a Delphi Firemonkey application. Any help would be much appreciated!

Thanks!

Comments

  1. Sounds interesting Ben - I’m not sure if anyone else having tried this but in theory it should just work. Is it just the updating of the text in the TextView within the Update event that’s failing? What if you set the label text at design time, does it show that text?
    Can you share a simple example on GitHub so we can download and take a look?

    ReplyDelete
  2. Hi Chris, I've added both sides of the project to GitHub at this link github.com - BIWhitfield/android-widget-in-delphi-app-build

    You should be able to download the sources and build what I currently have following the instructions there.

    ReplyDelete

Post a Comment