语言

Menu
Sites
Language
How can I know whether my app is launched from Alarm or not?

Hello, 

 

I'm making an app using Alarm API.

I could be able to launch my app at a specfic time adding an alarm set my app's id.

But how can I know my app launch is triggered from alarm or not? I should know this because I want show a notification when an alarm triggered my app. 

 

Thanks.

Christian.

编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

2 回复
Raghavendra Reddy Shiva
At this moment, i cannot find any methods either in Alarm or Application API's which provide such information. But alternatively, we can build some logic around the current Alarm API supported methods to conclude if the application is launched with the alarm trigger or not. As each client application has its own individual alarm storage, we can query for the alarms events and then check if any of the alarms are expired with the current date and time of application launch. This might need some book keeping values or flags checked and updated for every time the application is launched. For Relative alarm, you can use "getRemainingSeconds()" method to check, if the alarm has expired (returns null when expired) Similarly for Absolute alarm, getNextScheduledDate() method to check ,if the alarm has expired (returns null when expired) Will also explore more and see if there is a better way to do this.
Christian Soe
Many Thanks. This really makes sense to me.