Block and/or Silence incoming notifications - ios

My company is currently contracted to write a meditation app. While we have the app 90+% done the client has come up with a new requirement they would like implemented. Thankfully we have not agreed to the new requirement as we were not sure if it is possible or not.
They have seen in other apps (games were the only examples they were able to provide) where notifications (i.e. incoming email) did not appear and did not play a sound.
I have searched the old google god and have not been able to come up with an answer for my higher ups. Is there a way to accomplish this or is this something that is only available for games?
Thanks.

I don't think it is possible. The only thing that I would guess is that you would turn on do not disturb pragmatically. But there is no code for that, that i know of.

Related

Can an iOS app passivly listen for a certain sound?

I know the iPhone responds to "hey Siri". Is there similar features that I can use in my app to listen for certain sounds? If so what is the name of the iOS framework to use?
No, there is no API for that. Hey Siri is part of the OS and has hardware-level support. Your app can only use the microphones while it’s running; there is support for keeping the app alive while it’s recording audio, but the battery impact would be severe—the device can’t go to sleep—so it would be extremely unlikely to pass app review. That said, if you’d like API support to be added in future, please file an enhancement request with the use case you have in mind.
Yes sure, you can implement a recorder that records from the microphone and then you check anything you may need from recorded files.
Btw, what do you mean by certain sounds?
I think it sounds a bit tricky so please elaborate on your question. What's the business reason? How will you perform "listen for certain sounds"? How do you check it for being "certain". I think it's quite a hard thing to do using iOS but maybe I got your question wrong.
UPDATE: According to your comment: yeah it's possible but not like "hey ios check if it's a gunshot" :)))
But I think you can do it by checking the volume of the sound. If it is loud then it's a gunshot. I think it will work since user will use it on purpose. Check this link.
Also, I saw a similar app for gun shooters. So I'm sure it's doable:)
So shortly: find the way to: 1. use microphone. 2. Listen to sounds. 3. Check the sound for volume/length 4. Try detecting by testing
PS: Be careful with shooting while coding :)
If your "certain" sounds are referring to spoken words. Apple has the Speech Recognition framework for determining particular words.
If you are trying to measure perhaps a particular frequency however, Like many guitar tuner apps use or other music recording type app, I would recommend checking in depth AVFoundation 's guide to audio engineering.

Is it possible to create a call tracking app on iOS?

From all I have read here, creating a call tracking app on iOS seems impossible. However, after some investigation, I have found a couple of workarounds and would like to know if they are legal and would work at all.
So, at least, I will need one of these features:
access call log history. I've read that's impossible, but also I know that on many devices where iCloud backup is turned on, call history data is saved there, so using some API, for example, this, I can access it. Am I right?
receive notifications when the call is ended. I've read this is possible only in foreground, therefore makes no sense. But following this question, I see that you can initiate calls from the application, which allows at least to track outgoing calls.
Would this be enough or I am wasting time?
Unless you're running on a jailbroken device, the answer is no because there is no publicly available API that provides access to the call list and that is a good thing from a privacy point of view.
A quick search shows that CallKit is for integrating VOIP into the call list, so again the answer is no, CallKit will not be of any use to you.
The notifications are there so that your app can respond properly to calls that take place while it is active.

How do social networking apps update their UI in real-time?

I was wondering how social networking apps, such as Twitter, Facebook and WhatsApp update their user interface in real-time when another user interacts with the user of the app. To use the best example I can think of: when you have a chat window open in WhatsApp, the UI updates automatically (without any user actions required) when the user you're chatting with interacts with you. Messages appear on your screen without refreshing and the "last seen" status at the top of the screen updates automatically when your chat partner either goes offline or comes back online. I can think of two ways to achieve this:
Remote push notifications: this approach strikes me as the 'cleanest' way to do this, but it's probably also the riskiest way. Using silent notifications (content-available) to pass data to another device at the moment a user does something, would probably save you a lot of HTTP requests and therefore would make your app consume a lot less data and CPU usage. The risk of this approach is that a user can easily disable ALL push notifications to save battery power (including silent notifications) and then your app wouldn't be able to get notified on events remotely.
Local UI refreshing: This approach is obviously the safest, but I think it's really 'nasty' and eventually everyone would feel the downside of it. Constantly refreshing the UI and re-retrieving data from the database to make sure the latest messages and statuses are displayed to the user would be safe in the way that your app doesn't have to rely on the device's battery and background mode settings, but the downside is that this will make your app consume a lot of data and battery power, which would be bad for the user's data plan and his device. I also don't think Apple would approve of an app that's consuming so much data and power.
I've just implemented a chat function into my own app, and I want to enable the same real-time UI updating that WhatsApp uses. What would be the best way to do this? Should I use one of the two methods above or can someone think of another way to do this? By the way, I'm a relatively new programmer who just recently learned how to develop iOS apps (Swift). I'm very far from being a pro, so please go easy on the explanations and work method capabilities. Thanks!
The chat apps make use of WebSockets to create a constant connection with the client and a backend server.
This article on Appcoda can help you start learning about Socket.io. It answers your questions and also helps you to create a demo app.

Detecting outgoing emergency call vs Developing custom dialer app

My goal is to listen only and not modify the outgoing call event and send GPS coordinates to server from background. I'm not even interested in phone number being dialed, what I only need to know is whether the current call is Emergency call.
I've accomplished this easily in android, by following this tutorial.
However some googling showed that, this is a big pain in the ios world.
The only solution I think is to write dialer app from scratch and manage all the events by myself (if that's even possible), but I think it's too overcomplicated
I'm completely new to ios and please let me know, how would you solve this problem guys?
There is no way this will be possible on iOS unless you were planning to release and app for jailbroken phones (and even then I'm not sure it is). The Core Telphony framework has the methods you can use: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/CoreTelephonyFrameworkReference/index.html

real time messaging for multi player game on ios

Building a multi player iOS game where players compete one against the other. Nature of the game is synchronous. Basically, players either invite each other through facebook, email, etc and then start playing.
We debate what is the best strategy for facilitating the real time communication between players (sending events, etc). Coming from web development, we used comet and long polling which worked great. However, it's not clear what's the best way to achieve that on iOS.
Seems like APN (Apple Push Notifications) is not suitable in our case for two reasons: the delay can be pretty significant, up to few seconds, as far as we understand. Also, using APN requires the user to authorize notifications. If the user doesn't authorize this then it won't be possible to play the game.
Also, we understand Apple's Game Kit (Game Center) can be of value in our case however it's not clear how it interacts with invites through facebook etc. Also, not clear if we need to get into bed with Apple's Game Center and how it'll affect the user experience.
Any guidance on this matter as well as other options that you might think of would be greatly appreciated.
Thanks for your help.
Before you read the rest, a disclaimer: I work for Realtime.co but I do believe I can help here so I'm not trying to "pitch a sale".
If you need to have real time updates, you can check out Realtime (www.realtime.co). It's basically a set of tools for developers to use real time technologies on their projects. It uses websockets but does fallback to whatever the user's browser supports (such as long polling, for example) if you are using a browser (which is not your case, but it's always good to know).
Behind Realtime you have a one-to-one/one-to-many/many-to-many messaging system that will transport your messages to and from your users.
There's a iOS API too which you can use in your project. You can download it here: http://www.xrtml.org/downloads_62.html#ios and check the documentation here: http://docs.xrtml.org/getting_started/hello_message.html#ios.
There's also a plus which is the fact that the Realtime framework is actually cross-platform. This means that you can even have your iOS players to communicate with players using Android, Windows Phone, HTML5, Flash, etc. if you decide on expanding your game to other platforms.
I hope that helps!
I'll just provide some insights on the question.
APN should never be used for synchro communication as for iOS at least, you'll never have both way communication (basically the Apple APN servers are pushing an information to the device).
You should probably play with C sockets in order to open a tunnel (depends if your game is real time or not).
Using the Apple Framework GameKit is great! But might take some time to understand all the functionnalities.
Check out Gree
https://developer.gree.net/en/
Parse:
https://www.parse.com/
Sparrow:
http://gamua.com/sparrow/
There are a few things that your talking about, there is the joining/starting of a game, and then the communication between the players. They are not necessarily related.
You can use game-center and at the same time another framework for facebook, they are not mutually exclusive (but it would be more work.)

Resources