How to set alarm in BB10 - blackberry-10

Hi I am developing an application to set alarm in Blackberry 10 cascades. I have searched a lot and i found setting Remainder. But I want to set Alarm and an mp3 file as Alarm tone. Is there any way to this in Blackberry 10 using Cascades.

No, this is not possible. There is no API to programatically set the user's alarm.
However, you can invoke the clock application to a specific view-state (alarm screen) and allow the user to set the alarm themselves.
Here's how to invoke an app:
https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/sending_invocation.html
Here's the info on how to invoke the alarm clock:
https://developer.blackberry.com/native/documentation/cascades/device_platform/invocation/clock.html

Related

Creating an alarm application for the iPhone

I have an idea for a unique alarm application on the iPhone. But at the moment the only way I can see of initiating the alarm is by leaving the app running all night getting it to poll for the current time. Is there anyway to make an app "wake up" or initiate at a certain time. I know I can use push or local notifications but they require user input before loading my app. Thinking about it I could leave my app on all night, but literally doing nothing (saving battery if not being charged) and then subscribe to a local notification for the alarm itself.
Alternatively, can I make the iPhone run my app when an alarm sounds so I don't have to deal with alarm settings at all?
No, your only option is to use either Local or Push notifications.
I think using event kit framework add event in default iPhone calender.

Is it possible to run an application from my application when it's running background state?

Is it possible that my iphone application will run in background state and after some time interval it will start another program or application from my iphone.
Suppose, I want to start the camera preview after 10 minute later that will be handled from my iphone. So, my application will run in background state and it will start the camera view after 10 minutes.
Is it possible ???
The only way to start other applications is to use the url schemes exposed by the other app. If it does not expose such scheme, you won't be able to start it.
What about scheduling such thing when you're in the background, you can register for timed local notifications that will show a popup to the user when the time has been elapsed. If the user accepts the popup, your application will get focus and CPU so you can launch also other apps.
There is another option, to get some seconds of CPU in every 10 minutes. It is called VoIP services and you can register for it in the project settings, then it'll call a callback in your app delegate when the OS decides to grant you some CPU.
Study "local notifications" and "url schemes", these are the technologies you need.
Specifically on whether your app can do anything while in the background state, recommend watching the 2010 WWDC video "Session 105 - Adopting Multitasking on iPhone OS, Part 1" : https://developer.apple.com/itunes/?destination=adc.apple.com.4092349126.04109539109.4144345587?i=1907522673
TL;DR: you can only finish up tasks upon entering the background. MrTJ is right about using a timed local notification, and you can also investigate Apple Push Notifications too, if a bit more work and outside the scope of your original ask.

Alarm clock app in iOS

I have to create an alarm clock app for the iPhone in which user can set alarm time and sound.
In doing so, I have used UILocalNotification to set off the alarm.
Now, in UILocalNotification, first we get Notification Alert with option "Close" and "View". If the user taps on "View", then my delegate receives the application:didReceiveLocalNotification: message and the alarm sound plays.
But in the system-native alarm app, we don't see a notification alert; it just directly plays the alarm sound. How can I have my app use this behavior?
I agree with David. iOS built-in alarm app gets a special treatment from Apple to sound > 30 seconds while in the background. It seems to be using some private API to make it sound for a longer time even when it is in the background or closed. This is not available to other apps built outside of Apple, so don't even try to compete with it. If you buy all Alarm clock apps in the App Store (aka: approved by Apple) and try them one by one, you will see that they lack behind the built-in alarm app in the most important function of an alarm: i.e. "Sounding for a long period, in any state the app is in (active, background, or closed)"
Your best bet to simulate a background alarm is to make use of UILocalNotification for 30 seconds. If you really want to wake up your heavy sleeper, schedule to fire up five of these notifications sixty seconds apart or something like that, in the hopes they will wake up before the 5th notification ends.
Notice that with this method, your user who misses the alarm will get 5 popups on their screen when they wake up (less if they wake up during one of the alarm popups), so they'll be spending their first seconds of their morning closing those popups - not the greatest user experience.
Conclusion: Alarm Clock apps are good for foreground use only. Best Alarm app out there that will work in any state is the built-in Clock app made by Apple.
This alarm behavior is not available to iOS apps. You have the ability to create local notifications and add sounds to them, but the sound length is limited. You cannot have a sound continuously play such as on the built-in alarm.
One option is to repeat the alerts. So your app would send an alert, wait some time then send another. You repeat a specified number of times or until the user interacts with your app. I don't think this would provide a great user experience, so I don't recommend it.
I am pretty sure you can have your own custom local notification sound.
Example code localNotif.soundName = #"alarmsound.caf";
Note local notification sound will have to be of only 30 seconds or less to be played. You can get more info here.
If you enable the "Audio, AirPlay, and Picture in Picture" and "Remote notifications" Background Modes, you can use a silent push notification to wake up the device and then start playing audio, and as long as you’re playing audio you won’t be limited to 30 seconds to respond to the notification like usual. This won’t work if the app has been killed manually by the user, but if the user does that you could send a local notification asking them to re-open the app.

Setting an iPhone alarm in code?

Is it possible to set an alarm & alarm description for the iPhone's alarm clock application WITHIN my application code? So for example, set a 7:00am alarm with a description 'make coffee" in code. So when the user exits my program, if they enter iPhones clock application it will have a 7am alarm set?, any responses will be greatly appreciated. thank you
Nope—your application is sandboxed by the system and cannot access or modify other apps’ data. You can create your own scheduled notifications, however, using the UILocalNotification class; if you Google that, you’ll find plenty of examples of how to create alarm-like alerts that way.
Shouldn't Event Kit serve your purpose?

iPhone iOS4- playing an alarm in the background?

I am working on an alarm app for the iPhone and I cant seem to figure this out. My question is regarding capabilities of backgrounding. Is it possible for a user to specify a certain time for an alarm to play in my app, say 7:00 AM. The user is using iOS 4, and exits the app, but it is still running in the background. Is there anyway for my app to play a specific sound file at that specified time, 7:00 AM? Or can I order my app to relaunch itself somehow at that specific time. If none of these are possible, what are the closest alternatives?
You should use a background (local) notification for this - they can trigger sounds.
In iOS 4.0 you can create a UILocalNotification set to go off at a specific time/date.