Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Android Services (activity not found, maybe you are in a service) urgent!



Permlink Replies: 2 - Last Post: May 3, 2016 5:31 PM Last Post By: Thiago Silva
Thiago Silva


Posts: 37
Registered: 12/20/04
Android Services (activity not found, maybe you are in a service) urgent!
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 28, 2016 4:26 PM
Hi Everyone,

My company bougth the Delphi 10.1 Berlin and we start to developing an Android Service. But, the first time you create the app service, its going correctly, but if you change anything at the project, the following message appears when you compile and start the service again "activity not found, maybe you are in a service".

Following the source code:

FService := TLocalServiceConnection.Create;
FService.StartService('MyService'); -> Error occours after this

I read some posts but without conclusions. What´s happens to causes this error? For example, if you get the Jim McKeeth (youtube demo) example, and add a unit at the service, the error show up.

Regards,

Thiago

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Android Services (activity not found, maybe you are in a service)urgent!
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 29, 2016 10:07 AM   in response to: Thiago Silva in response to: Thiago Silva
Thiago wrote:

What´s happens to causes this error?

The error comes from the TAndroidHelper.Activity property getter. The global
System.DelphiActivity variable is not initialized properly in a service,
so anything that relies on the TAndroidHelper.Activity property is not usable
in a service.

--
Remy Lebeau (TeamB)
Thiago Silva


Posts: 37
Registered: 12/20/04
Re: Android Services (activity not found, maybe you are in a service)urgent!
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 3, 2016 5:31 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thank you

Remy!
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02