如何将桌面 Groovy 应用程序移植到云/Android
我有一个已经开发并正在生产的应用程序。它是用 Groovy 开发的,作为一个具有自己的 UI 的桌面应用程序,其目的是每分钟对网站进行屏幕抓取以提取一些信息,并在需要时向用户显示警报。
现在我正在尝试将这个应用程序移至Android,这样它就可以在手机开机时一直可用(用户在白天收到的警报越多越好)。在开始之前,我想收集有经验的人的意见(还没有接触过 android):
我看到以下在 android 中设置应用程序的方法:
只需将整个应用程序移植到 android/java 并让它运行一直在后台,或多或少地执行应用程序现在所做的事情。考虑在内。
我认为在 Android 上运行 groovy 是不可能的。我想我曾经看到过一些关于将其移植到 Android 的项目的参考,但它太慢了,毫无用处。所以一定是android/java
每分钟获取 html 页面(或者如果我减少,则更少)并进行所有解析等是可行的还是会消耗大量电池?内存怎么样,解析的页面不可能这么小,android上有限制吗?
在某个主机中设置一个服务器端,每分钟进行一次屏幕抓取,并且只向运行 Android 应用程序的后台发送警报,这比之前的要轻得多。
我假设 Android 应用程序中有一些内置的推送功能可以监听?
推荐什么服务器端托管/服务(以及出于什么原因、成本、性能、易于使用......)。
我的猜测是 2,由于与 android 的亲和力,使用 GAE,也许我什至可以使用 gaelyk 来重新使用我的部分 groovy 代码...
我的目标是 android 2.2.1 及更高版本。用户数量很少且易于处理,因此更新 Android 应用程序不是问题。
谢谢
I have an application already developed and in production. It's developed in groovy, as a desktop application with its own UI, and its purpose is to screen-scrape a website to extract some information every minute, and show alerts to the user when it need to.
Now I am trying to move this application to android, so it will be available all the time the phone is up (the more alerts the user gets during the day the better). Before starting I would like to gather opinions from people with experience (haven't touched android yet):
I see the following ways to set the app in android:
just port the whole application to android/java and have it running in the background all the time, doing more or less what the app now does. To take into account.
I assume running groovy on android is out of the question. I think I saw once some reference to a project to port it to android but it was so slow it was useless. So it must be android/java
Getting the html pages every minute (or less if i decrease) and doing all the parsing etc is doable or drains to much battery? What about memory, pages to parse could be not so small is there any limit on android?
Set up a server side living in some hosting doing the screen-scraping every minute and only sending alerts to the background running android app, that would be much lighter than the previous one.
I assume there is some built-in push functionality in android apps can listen to?
What server side hosting/service would be recommended (and for what reason, cost, perf, easy of use...).
My guess would be 2, using GAE due to the affinity with android and maybe I could even use gaelyk to reause part of my groovy code...
I am targeting android 2.2.1 and up. The number of users is very small and easy to deal with so updating the android app is not a problem.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您选择#1,您不仅会耗尽手机电池,还会为您正在抓取的网站产生更多流量(如果所有用户都抓取相同的页面)。无论如何,我会选择#2。 (您是否考虑过发送电子邮件或短信而不是编写应用程序?当然,这实际上取决于您的用例...)
关于服务器平台:
GAE 和 Android 都是 Google 提供的,但我不明白如何做到这一点在这种情况下会帮助你。我开发 GAE 应用程序,但从未遇到过任何针对 GAE 的 Android 特定功能。然而,GAE 似乎很适合您的预期用途。您很有可能获得免费实例(取决于您需要执行的处理量,这取决于用户和抓取的数量)。
您还应该考虑的一些要点
从好的方面来说:您不必处理管理问题,可以专注于编码。我相信 EC2 在这方面参与得更多。 (至少这就是我选择GAE的原因)。当然,GAE 的技术关注度更高。
希望这有帮助!
PS:需要澄清的是,我没有使用 Android 的经验。
If you choose #1 you will not only drain the phones battery but also generate more traffic to the web-site you are scraping (if all users are scraping the same pages). In any case, I would go with #2. (Have you considered sending out an email or SMS instead of writing an app? Of course, this really depends on your use case...)
Regarding the server platform:
GAE and Android are both by Google but I don't see how that would help you in this case. I develop GAE apps and never came across any Android specific features for GAE. However, GAE seems like a good fit for your intended use. It is quite possible that you could get away with a free instance (depending on the amount of processing you need to do, which will depend on the number of users and scraping).
Some points you should also consider
On the plus side: you don't have to deal with adminstration and can focus on coding. I believe EC2 is a lot more involved in that respect. (At least that's why I chose GAE). The technology look-in is greater on GAE of course.
Hope this helps!
P.S.: Just to be clear, I have no experience with Android.