简体   繁体   English

JavaFXPorts作为Android上的后台服务

[英]JavaFXPorts as background service on Android

Task 任务

Basically what I need is to send a request to a server every minute. 基本上,我需要的是每分钟向服务器发送一个请求。 When the server returns false, nothing should happen. 当服务器返回false时,什么都不会发生。 When the the server returns true, a sound should be played. 当服务器返回true时,应播放声音。

Problem 问题

This usually only works when the program is in the foreground, but it should work all the time. 这通常仅在程序位于前台时才起作用,但是它应该一直在起作用。

Question

Is it possible to let a javafxports app run on android as background service? 是否可以让javafxports应用在Android上作为后台服务运行?

This probably should work. 这可能应该工作。 You have the full Android Api with you. 您将拥有完整的Android Api。 But I don't know how to integrate this with the JAVAFX Port. 但是我不知道如何将其与JAVAFX Port集成。

I think you need an extra Activity for that, and if you want to show the gui you have to start the JxPort Activity. 我认为您为此需要一个额外的Activity,如果您想显示gui,则必须启动JxPort Activity。

Maybe this helps: https://developer.android.com/training/run-background-service/create-service.html 也许这会有所帮助: https : //developer.android.com/training/run-background-service/create-service.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM