安卓:闹钟应用程序的最佳做法? [英] Android: Alarm app best practices?

查看:128
本文介绍了安卓:闹钟应用程序的最佳做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个简单的闹钟应用程序,以进一步自我介绍Android开发。

I'm writing a simple alarm clock app to introduce myself further to android development.

我看过了Android教程报警;启动服务和活动。在我的情况下,我想设定闹铃时间,然后开始运行了说半小时报警触发后的东西。

I've looked at the android tutorials for alarms; for starting services and activities. In my case I want to set an alarm time, then start something that runs for say 1/2 hour after the alarm is fired.

在这半小时就会有后台任务发生的事情,而且在屏幕上所显示的信息。

During this 1/2 hour there will be background tasks happening but also on-screen information being displayed.

我主要是好奇,是什么在这种情况下,最好的做法。我应该运行的后台任务,作为服务前台作为一项活动?由于屏幕上的活动的同时,在后台任务运行时会是只是为了更好地运行在所有的活动?

I am mostly curious as to what is best practice in this case. Should I run the background tasks as a service and the foreground as an activity? As the on screen activity is running at the same time as the background tasks would it be better just to run it all in an activity?

干杯!

推荐答案

我会说,最好的办法就是谷歌做它的方式。 <一href="http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android-apps/4.1.1_r1/com/android/deskclock/AlarmClock.java#AlarmClock"相对=nofollow>看看。

I'd say the best way is the way Google does it. Take a look.

这篇关于安卓:闹钟应用程序的最佳做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆