Get user activity information from other applications - ios

My question is that is there any way possible to get what users are listening to using other music services, such as Spotify or Pandora?

iOS have everything sandboxed so apps do not mess around with data of other apps. A little while back it was absolutely impossible for 2 of your own apps to share some information with each other.
iOS 8 has changed that by Inter-App Communication but not to the extent where you want it. Even in iOS 8, the recepient app has to provide the functionality and should handle your incoming request to see what music they are playing.
Your better course of action would be look up if Pandora or Spotify have some API which let's users login, and share their listening history with your app.

Related

iOS SDK can you mute or cancel incoming calls

I found various threads here about how muting or canceling incoming calls (or messages) with the iOS SDK is not possible, due to the fact that Apple doesn't want an app to access system level settings. Well in fact not possible with the official tools, which means that if you somehow manage to do it, your app will not be accepted in the iTunes store.
Well I have been asked to assess the possibility of such an app that could do just that. Namely my client has seen these two apps
https://itunes.apple.com/us/app/lifesaver-distracted-driving/id874231222?mt=8
https://itunes.apple.com/us/app/at-t-drivemode/id907208943?mt=8
And they are sure that an app, basically exactly like these (based on the functionality) can be made.
So here I am, asking, how did these two apps succeed at the impossible and also how did they manage to get those apps uploaded to the iTunes store, if muting your phone is not an Apple approved option? I am not really asking for source code, although I am certainly not rejecting examples, but moreso I am asking for pointers of what class or book or documentation do I have to look up to figure out if this is possible? Apples CTCall and CT* classes did not seem to help me much.
K
Apple added the CallKit framework in iOS 10 to allow app developers to do this sort of thing, among others. For docs, see:
https://developer.apple.com/reference/callkit
It is now possible to detect and block unwanted phone calls from iOS 10 and above.
See the CallKit framework
The CallKit framework (CallKit.framework) lets VoIP apps integrate
with the iPhone UI and give users a great experience. Use this
framework to let users view and answer incoming VoIP calls on the lock
screen and manage contacts from VoIP calls in the Phone app’s
Favorites and Recents views.
CallKit also introduces app extensions that enable call blocking and
caller identification. You can create an app extension that can
associate a phone number with a name or tell the system when a number
should be blocked.

How can I get Alexa working on my iOS app?

I have been checking out the Alexa Skills kit the past few days. I have also been poring through the documentations for both the Skills kit and the Voice Service. I am just having a little hiccup trying to understand the flow. I have implemented one of amazon's sample skills (favourite colour sample) in the developer console and also wrote a sample lambda function to handle the type of response that will be delivered. Its working on the test simulator and what left is basically getting lambda running through my ios app. However I have the impression that I don't have to use the voice service. Am I wrong? I am quite confused, it would be awesome if anybody who has some more clarity could shed some light on the matter. If I get lambda working also, I think it will accept requests that are in a particular format. Where do I have to send the encoded audio to get a json response to send to the skills kit? To the Alexa Voice Service?
Also I am authenticating my app using cognito and dynamo db. If I were to use Alexa Voice Service, then it is mentioned that the user will have to also login to amazon. So do I still have to work with the login with amazon sdk? Or is there a workaround?
Based on Amazon documentation there are two ways to interact with Alexa:
Sounds like you want to implement the app thru the Companion method.
As far as the JSON goes, i am currently resolving that issue now, (will post answer once I have it resolved).
Basically you have to use AVFoundation to capture audio from iPhone and send 2 https messages to Alexa (One message with JSON Body & the second message with audio captured as body.) Bases on Documentation
Companion App
(You have a device (such as a smart speaker) that you want to add Alexa to. So, you build in support for AVS. Great! Now you need a way to authorize it and associate it with the user's account. This is the "companion app" approach. The companion app connects to your smart product and allows the user to login and authorize the speaker to use Alexa and connect to their Amazon account.)
Mobile OR Website
AVS App
(You don't have a device you need to authorize - instead you want to speak to Alexa from within your Android/Iphone application.)
Android or Iphone
You can find a swift example on github on how to implement a iOS AVS client
https://github.com/chintan1891/iOS-Alexa

what is the way to get all apps notification alerts to my app from notification centre in ios 7 & 8

I'm working on project which has tricky part. I want to get all notifications from Facebook, Whatsapp and some of the other app to my app notification centre from that i want to send data to the external peripheral device which will notify the user.
You can't. Also this is a duplicate of this thread, so I'll quote from there.
There is no way to get all of these notifications in your own app. You
can use the CoreTelephony to access some of the data related to
incoming calls and you could integrate Facebook and Twitter APIs to
get that data, but you really would have to do it all yourself.
There's no silver bullet here unfortunately!
Even if you used private API, its highly unlikely you'll find a way either, not to mention that your app will be rejected on the app store for using private API.

Is there inter-app communication when apps start in iOS?

I am relatively new to iOS app development and I'm just trying to figure out some things that, to me, are more abstract. How do apps know when other apps start? The closest example I can think of to what I'm trying to ask is when music is playing in the background and you open another app that has sound and the music stops. Is that the new app taking authority or is there inter app communication? If there is communication how does that communication work? Like is it a message that could be accessed or what?
Sorry if that didn't make much sense, I tried to elaborate the best I could. I couldn't find anything on this on apple's developer website. Thanks in advance!
There is no inter-app communication. Each app is living in its own world, and as far as your app is concerned, it's the only app on the phone. The way communication happens is that an app talks to the system, and the system talks to your app. The way the system sends messages to your app is usually in the delegate of the framework you're working with. In your example, opening your app to play audio will send a message to the system, and the system will tell the other app to stop audio playback. That other app has no idea it was your app that initiated the stop. Another example is the AppDelegate. The app delegate will send your app messages such as application:didFinishLaunchingWithOptions:, which in this method is where you do custom initialization of the app or applicationWillResignActive: which is normally sent when the user presses the home button or receives a phone call, so here you might want to save your game, etc.
In fact the iOS system is quite complicated, much to complicated to be explained in detail here so I highly suggest reading the Apple Developer Documentation, some of it can be a little dry, but they do their best to be coherent with even absolute beginners.

Stream song via Spotify SDK without Spotify account on the users' side?

Is it possible to build an iOS app that streams from spotify in a way where it won't need the user to login to Spotify? In a way where only our application is registred.
It is just not clear after scanning through the SDK / API section.
Disclaimer: I didn't work with the Spotify SDK
It should be possible. I suppose you can hardcode the login info in the code directly, and have the app login to spotify with the same user account every time (the one hardcoded in the app).
On the other hand, I don't see a good reason why you would want all the users of your app to connect as the same user to Spotify. But that is your decision :).
Also, I think you should also check the Spotify terms and conditions before you do that. Not sure if that's an issue or not.

Resources