RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!
C++

How to use Android Service(TAndroidService) in C++Builder

Author: h.mohri

[Make a new project for Android service.]

File→New→Other

NewItems→Delphi Project→Android Service.

After making the above selection, click OK.

 

Select a “Local Service” and click OK.

TDM class that inherits TAndroidService will be created.

Place the TNotificationCenter.

Create an OnStartCommand event and write the code.

I saved it with the name p1.

 


 

[Create a C++Builder project]

Add it to the Project Group.

 

Select New Items→Mulch-Device Application .

 

Select Android target platform. 

 Place TButton, TMemo, TNotificationCenter in the form.

Add Android service.

Right-click the Android target device.

 

Add Android Service Dialog comes out.

Select automatic.

Specify a directory of service project that you saved.

 

Make sure it is correct.

 

[Create a button click event]

[Create NotificationCenter1 receive events.]

Write the code in OnReceiveLocalNotification.

 


 

[Execution]

Tap Button1 to start Android Service(“p1”).

Write TNotification received from Service to Memo1→Lines


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Learn More About Upgrading

Related posts
DelphiRAD Studio

Get Started Building Cross-Platform Games In Delphi FireMonkey With Alien Invasion Sample

C++Delphi

Ultimate Compression Toolkit For Delphi And C++ Builder Developers

DelphiNews

RAD Studio with Delphi - The Original Low Code!

DelphiShowcase

KisKis The Crazy Social Network For Android And iOS In Delphi

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES