Is there a way to trigger a video using timer? - windows-phone-7.1

I am trying to build an app in which I want to trigger a video using timer, i.e. similar to alarm instead of alarm pop-up(with snooze & dismiss option) with music, i want my app to open the video page.
Please suggest me how to proceed.

It's not possible to have an application start at a specific time. Apps can only be started in direct response to a user interaction.
There should be no problem in calling play on a mediaelement when a time (countdown) fires (expires). What specific problems have you had.

Related

Can I use facetime in my own iOS app to measure call duration between two users?

I want to implement a functionality where users of my app can call each other on iOS. A convenient way would be using the built-in facetime.
Is there a way how I can take the time the call lasted?
For example:
Alice calls Bob.
Bob takes call and timer starts
As soon as the call is ended, the timer stops.
Can this be implemented using facetime?
As far as I know, you can only initiate facetime calls (using the facetime:// URL scheme). There is no way to know if the call went through, and if it did, how long it took.
In short: No.

Is it possible to build an alarm clock such as the built in app from Apple?

A lot of todo-list apps such as Wunderlist offer some kind of reminder feature which usually just fires off a notification.
But I have never encountered an app that offer a similar notification view as the built in preinstalled alarm clock. You know, that locks the phone and offers a snooze option.
This makes me wonder if the alarm clock functionality that is built into the preinstalled iOs app from Apple including setting time or add a snooze button etc is only available for that particular app?
Since I'm a designer without any coding skills I only want to know if it possible or not.
Unfortunately this is unavailable for developers. You can check all of alarm clock apps in AppStore, all of them are using the standard local notifications. Which will fire once and that's all. You can of course set your custom sound and change couple of options, but it will never work like one build in Clock app inside iPhone.
You can read more about local notifications in Apple documentation: https://developer.apple.com/reference/usernotifications/unnotificationrequest
I figured Alarmy is constantly playing (when there is an alarm set up) a silent sound in the background. Like Spotify, but silent. This keeps the app active all the time. I came to this conclusion by logging the result AVAudioSession.sharedInstance().isOtherAudioPlaying (Swift 4) in my own application. Whenever Alarmy is terminated it returns false, whenever Alarmy is running in the background it returns true. Same thing happens for the app linked by Ernesto Elsäßer.
I used the same technique and I also used this pod to trigger a function when the time comes and start the real music.
I did this for testing and am not going to make an app out of it because playing silent sounds in the background is against Apple's rules. I don't know how Alarmy (or other apps that use this same method) got away with it.
Some related questions:
How do you constantly run in background?
App “Alarmy” is able to play iTunes song from background state… How?
Wake up application in background using AudioSession like Alarmy iOS app
Also you can check this article out.
This app seems to do exactly this, but I have no clue how ...
I tested it, and it managed to start playing music on a locked device at an arbitrarily chosen time, and for way longer than the 30s timeframe allowed for notification sounds. Further, the music is streamed from an online radio station, meaning they found a way to ...
wake up the app from a scheduled notification without user interaction
create a socket connection to a radio station in the background
start playing sound in the background for an indefinite amount of time
I also tried out the alarm in Airplane Mode, and it still played a locally stored backup song, so it probably doesn't abuse the VoiP background mode or push notifications, but really is triggered by a local notification ...
So although I can't tell how, it looks like there is an App Store Review-proof way to create a real alarm app.
(I am not affiliated with the developers of this app, just did some research on what's possible.)

MPMusicPlayerController does not send background notifications when using Apple Music (Sample Project is Included)

This is a problem that has been bothering us for months now. I created a bug report for apple, but they aren't responding. I also created a sample project that demonstrates the bug. I would really appreciate any ideas that you guys have. So without further adieu, here is the description of the problem and a link to the sample project. Thank you so much!
Sample Project: https://dl.dropboxusercontent.com/u/28210/AppleMusicBug.zip
MPMusicPlayerController is used to play Apple Music songs via the new setQueueWithStoreIDs method. This was introduced when iOS 9.3 was released. The issue is that once you leave the app, these two notifications no longer fire and wake up our app:
MPMusicPlayerControllerPlaybackStateDidChangeNotification
MPMusicPlayerControllerNowPlayingItemDidChangeNotification
The reason this is so so critical is that our app does not use exclusively Apple Music to play songs. We need to know when a song ends so that we can fire off code to play another song in our custom queue. Currently, this is impossible. We have attempted to use background tasks, but this does not work, as our methods does not work on background tasks. We need the same type of functionality that AVPlayerItem uses (AVPlayerItemDidPlayToEndTimeNotification) that will wake up our app when a song ends, regardless if the app is in the foreground or background. Without this, we can't use the API.
//////////////////////////////////
Steps to reproduce
//////////////////////////////////
Install the app on an iPhone with an Apple Music Premium subscription. Ensure that the permission settings are open for the test app. Ensure that you are able to play a full song in the music app using your Apple Music subscription. (I understand you might not have a premium subscription. I'm not positive, but the issue should still be present if you are playing a song using MPMuiscPlayerController, however you are able to play that song)
Open the test app.
A popup should come up confirming that the app sees your apple music premium subscription. It should say "Great. Now play a song."
Tap to play a song. The song should being playing in a few moments.
Tap the home button to bring the app to the background.
At this point you will notice that the notifications (MPMusicPlayerControllerNowPlayingItemDidChangeNotification and MPMusicPlayerControllerPlaybackStateDidChangeNotification) will not fire. When the song that you play ends, the application is not notified. Furthermore, you'll notice that the lock screen controls do not work, and remoteControlReceivedWithEvent is not notified of these events as well. Only when you bring the app back to the foreground are the notifications such listed above fired. This needs to work in the background.
Thanks for helping us with the issue. If you would like to discuss the problem more in depth via email, you can reach me at gabe#cymbal.fm.
:)

NSTimer run in background - needs to fire every hour

I created an app that will send text messages through an API similar to Twilio, and I have an NSTimer that fires a function every set amount of time. The problem is that if you press the home button, it will totally stop the timing, which defeats the purpose.
I have read that it is possible to have your phone play a mute sound until closed to make sure it still runs in the background, but I can't find a resource on how to do this. Here is an example: To run NSTimer in background
If anyone has any information on how to do this, I'm sure it is very simple, and I very much appreciate the help.
Thank you.
If you set up your app as a background sound playing app then yes, it is technically possible to play a "silent sound" in order to keep it active in the background, but your app will be rejected by Apple if you do this.
Apple expressly forbids what you are trying to do.
You should look at using scheduled local notifications. Those will alert the user, who can bring your app to the foreground and let it perform the desired task.

Equivalent of Android's services on iOS

I'm trying to implement an Alarm clock application for iOS. I have the basics down, like scheduling alarms and the like, but where I'm stuck is to start executing code in the background as soon as the alarm goes for ~ 1 minute / till the user turns it off manually.
Is this possible at all in iOS without the user explicitly swiping their finger to disable the notification and launch the app?
Thanks,
Teja
There's no real way to achieve this on iOS. The only types of apps that are allowed to execute code while not being the frontmost app are GPS/Navigation apps, apps that play audio, and VOIP apps. There's an exception that an app can ask the system for time to finish some long running task but this is probably not useful for your needs.

Resources