Jump to content

Search the Community

Showing results for tags 'androidservice'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. I have used Delphi 12 for developing Android application and I'm trying to Service which needs to runs in the background to receive the frequent messages from Server using TCP sockets to displays the notifications. But, the service is deactivated / closed after the main process application is closed. Below, the code is mentioned the code to start the service : procedure TForm1.ButtonServiceStartClick(Sender: TObject); var ServiceIntent: JIntent; begin ServiceIntent := TJIntent.Create; ServiceIntent.setClassName(TAndroidHelper.Context, StringToJString('com.embarcadero.services.MyService')); TAndroidHelper.Context.startService(ServiceIntent); end; and also, I have added the following service information in AndroidManifest.template.xml : <service android:enabled="true" android:exported="false" android:label="MyService" android:process=":remote" android:name="com.embarcadero.services.MyService"> </service> Code in Service: function TDM.AndroidServiceStartCommand(const Sender: TObject; const Intent: JIntent; Flags, StartId: Integer): Integer; begin Result := TJService.JavaClass.START_STICKY; end; I have tried to use this Solution, but not able to compile. And tried to implement the Sleep in Android Start command / run the thread, still the android service is getting closed. Do, I need to mentioned the different flag for starting the service or do I need to add additional code to run the service all the time or can we restart the service once it's destroyed and how to handle the code in Destroy event?
×