Is there any way to access an iTunes library to set an alarm tone? - objective-c

Is there any way to access an iTunes library to set an alarm tone?
I am building an alarm app. I think we can can use local notifications when my app is in the background, but it can't play music library sounds. So when the app is in foreground, I want to play sounds from the music library and songs from my app bundle as well. How might I achieve this?

You can select the music libray of your device using the MPMusicPlayerController.
For this you need to include the MediaPlayer.framework framework and <MediaPlayer/MediaPlayer.h> header file.
You will get the picked music url using this delegate method (for this you need to add the MPMediaPickerControllerDelegate in #interface) :
- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
{
}
Refer this tutorial for a detailed description.

Related

Which notification sends Deezer mac app

I'm currently developing a miniplayer app for controling some music player apps on mac os (iTunes, Spotify..) using scripting bridge with Objective-c.
Now I would like to add support for the Deezer Mac App but I can't find the name of the notification send by Deezer app if the player state changed. This is for set an observer in NSNotificationcenter.
For Spotify is it e.g. "com.spotify.client.PlaybackStateChanged".
Can anyone tell me this name?
The status of the player is available through the Apple Script :
Application -> player state.
It is actually a boolean style variable (true: playing / false: not playing).
Note: You can see all the available info if you open the dictionary with Apple Script Editor:
File > Open the dictionary > Select Deezer.app

Mac API to get current media playing

On the mac you can use their native 'f-keys' to do things like change volume, brightness, and even pause or play music or video.
I was wondering if there was someway to access to 'now playing' media (music or video) through an API or something?
I know it's possible to get currently playing tracks from iTunes using things like ITLibMediaItem or even from other apps by using Applescript to ask the application what it's header is. But how would you figure out which application is the 'currently playing' one and then get the play pause functionality?
Does Apple have an API for this?

iOS 7 App Operations Running In Background; Saving a Video Recording In Background

I am currently trying to find the most efficient way to continue a method in the background of my app.
I am probably adding location/gps to my app soon, so I was considering using that flag to keep the app Active in the background. However, I do not want to add that flag yet because I want to post an App Update before I add the location functionality.
I know the exceptions;
Apps that play audible content to the user while in the background, such as a music player app
Apps that keep users informed of their location at all times, such as a navigation app
Apps that support Voice over Internet Protocol (VoIP)
Newsstand apps that need to download and process new content
Apps that receive regular updates from external accessories
Besides asking for a more generic idea then these ^, can someone explain the "external accessory" flag please? I am recording video from an outside device. However, I do not know what constitutes an "external accessory".
I also see that iOS7 has introduced new Multi-tasking functionality but I haven't seen any examples that I understand can someone also explain that? Maybe that is a viable solution?
Thanks in advance!

How to open the apple app store internally using a modal segue

I am currently making an app that recommends other apps to download on the apple app store. I assumed that the only way for users to download these linked apps was to call the iTunes URL of the particular app -> the apple app store would then open pushing the original calling app into the background -> then the user would press the download button here as per normal.
Then I was playing with the app "App Hero" and they do something I thought wasn't possible. You can actually download another app to your device without ever leaving the "App Hero" application. I thought this was impossible due to sandboxing. They have a modal segue to what appears to be an embedded app store where you can commence installation of another app. This "embedded" app store doesn't have the usual UITabBar running along the bottom but everything else is basically the same.
Does anyone have any idea how they would have achieved this? It doesn't appear to be a UIWebView, perhaps I am wrong. And is this against any of the apple regulations?
*This is no way an advertisement for "App Hero". I am genuinely impressed/confused how they are able to do this and would love this functionality in my own app if it is allowed.
The class you are looking for is called SKStoreProductViewController. Docs here.

How do access native APIs with Sencha Touch?

If I wanted to create a mobile app that allows the user to take pictures with their phone, record audio notes and record video, how would I do that?
I was browsing through the Sencha Touch 2 API and while I see documentation on video and audio files, it seems like it is just providing a way for me to access files stored on the phone - not actual triggers to record, or take pictures.
Am I missing something?
How would I do what I want?
In order for Sencha Touch to have access to your phone capabilities, you need to use a product like Phone Gap
Unless there is a HTML5 api for doing those sorts of things I don't think you can do that. I know on PhoneGap there are native extensions added into that platform for access to things like microphone, camera, etc. I don't know if Sencha Touch has added any of those sorts of extensions in order for you do this.
Just thinking out of the box here, but you might be able to put Sencha javascript into a Web View from within an Android Java process. Then the Java code could expose an object in its process as an extension point to the Javascript engine for access to Camera, Microphone, what not.