Android Question Startserviceat activity

Stern0m1

Member
Licensed User
If I want to schedule an activity to start in the future the way to do it is startserviceat servicex and have servicex start the activity?

There is no way to directly schedule an activity to start?

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Stern0m1

Member
Licensed User
Thanks,


I am trying to use callsubdelayed from a service to start a sub in an activity.The log is showing "

sending message to waiting queue of uninitialized activity (start)
"
In other words its not starting the whole activity.

I guess because "Note that if you call an Activity while the whole application is in the background (no visible activities), the sub will be executed once the target activity is resumed."

I tried using Service.StartForeground but that didnt help.

does this makes sense? Is there any other way for me to do this?
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Is there any other way for me to do this?

Use this to wake your phone up (in the service, before you start the activity)

B4X:
Dim ws As PhoneWakeState 'Phone Library is needed
ws.ReleaseKeepAlive
ws.KeepAlive(True)

This works for me. For further info's search for "PhoneWakeState" or similar.

Important: Take a look at the phones energy saving. On my Huawei the app must be set as "protected". Otherwise it will be stopped completely by it when the screen is turned off. Had a lot of trouble testing my apps not knowing this.
 
Upvote 0
Top