把我报警前 [英] Bringing my Alarm to the front

查看:95
本文介绍了把我报警前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的报警器是在另一个线程这里的几个问题如果有人可以帮助,但无论如何这里是一个新问题。如果我用我的应用程序设置闹钟,譬如说从现在起5分钟,然后关闭应用程序,我将如何code它让我的应用程序的活动回来到前面?

I had a few problems with my alarm that are in a another thread here if anyone could help but anyway here is a new question. If I set an alarm using my app, say for 5 minutes from now, and then close the app, how would I code it so that my app activity comes back to the front?

这是基本相同的时钟程序已经在大多数Android手机。我这样做是为了让用户停止报警。我会说得对,我不得不改变我现有的code到,当运行报警,推出一个新的意图,使该活动在前面?或者,我可以简化这一点,只有有一个alertdialog什么的开放,而不是打开整个应用程序?

This is basically the same as the clock app already on most android phones. I'm doing this to allow the user to stop the alarm. Would I be right in saying that I would have to modify my existing code to, when the alarm is run, launch a new intent to bring the activity to the front? Or can I simplify this and only have an alertdialog or something open instead of opening the entire app?

任何链接将AP preciated

Any links would be appreciated

感谢

推荐答案

不要自动将您的活动移至前面。这是作为一个弹出式广告的讨厌!你真的要尽量打断谁是试图查找电话号码的用户?

Don't move your activity to the front automatically. It's as annoying as a pop-up ad! Do you really want to try to interrupt the user who's trying to look up a phone number?

相反,使用服务。当你想告诉用户什么东西,发表状态栏通知。您可以设置通知,弹出一个活动被点击的通知时。

Instead, use a Service. When you want to tell the user something, post a status bar notification. You can set up the notification to bring up an Activity when the notification is clicked.

大多数报警的服务实现的。

Most alarms are implemented in a Service.

这篇关于把我报警前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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