How do we find the list of VOIP URLschemes registered in the device? - swift

I DO NOT want to use the following:
if let url = URL( string: "tel://4151231234" )
{
UIApplication.shared.open( url, options: [:] )
}
Instead, I would like to have a list of supported URLschemes in the device that allows making phone calls. Something that would result in a list a bit like the following:
"tel://", "whatsapp://", "facetime://", "Hangout://", etc.
The problem using the "tel://" URL scheme is that iOS returns
iPhone Calls Not Available" on all devices that are not paired
with an iPhone even though they have VOIP apps that supports phone calls.
I do not want to become a VOIP app myself (using CallKit).
But I do not mind using using CallKit IF I don't implement
the entire API to become a phone app.
The Contact App has the behavior that I am looking for:
- When Selecting a contact (in the Apple's contact app),
Tap on "Call" at the top
- A pop up list of applications supporting phone calls is listed
including 'Call', "Facetime" and "Hangouts" (in my iPad).
I would like to have the list that allows the Contact app to know which apps (and also which URLschemes) can be used to make phone calls.
I bet it is simple... I just don't know ;( Help me please :<
I DO NOT want to use the following:
if let url = URL( string: "tel://4151231234" )
{ UIApplication.shared.open( url, options: [:] )
}
What would be the code to create a list of apps/URLscheme that support making phone calls?

Related

CallKit :- Callkit is working but the callee doesn't get the call

I want to develop an SOS application. When I am trying to use URL schema openURL(), it will display an alert but my requirement is to connect the call without any alert or popup while trying to call. So I found a solution using CallKit. When I implemented CallKit in my application it does not ask for any permission, the outgoing call is placed but the callee doesn't get any call. Is there any solution for this?
I have tried the following code for connecting the call.
#IBAction func buttonCallTapped(_ sender: Any) {
let provider = CXProvider(configuration: CXProviderConfiguration(localizedName: "My App"))
provider.setDelegate(self, queue: nil)
let controller = CXCallController()
let transaction = CXTransaction(action: CXStartCallAction(call: UUID(), handle: CXHandle(type: .phoneNumber, value: "\(number)")))
controller.request(transaction, completion: { error in })
DispatchQueue.main.asyncAfter(wallDeadline: DispatchWallTime.now() + 5) {
provider.reportOutgoingCall(with: controller.callObserver.calls[0].uuid, connectedAt: nil)
}
}
You just can't make standard native calls through CallKit. The CallKit framework, as clearly stated in the documentation, is meant to be used to develop custom VoIP applications and integrate them with the native phone interface.
Any iOS application can't make native call without user action.
An alert will be shown with phone number and two buttons will be available "Call" and "Cancel" which is presented from the OS level.
Just like we are showing popup to delete photos from Photos app.
Solution
If you want to implement SOS Application (Yes its possible using VoIP
service), But you can place calls when app is active (Can be done
without user action given internet connection is there.)
Note: The receiving side also should support VoIP.
How to Implement VoIP
We need permission of Voice over IP services to make calls in between iPhone devices.
VoIP app must have background mode enabled in the Xcode Project >
Capabilities pane. Select the checkbox for Voice over IP
Also CallKit is indented only for VoIP Apps, If you really want to implement the VoIP follow CallKit Tutorial

How to get the list of applications suitable for routing from the user’s device?

Is there any way to check if user has a certain app (google.maps, yandex.maps or native maps) on his/her device to make a list of apps suitable for routing?
You can check if user has this apps on device (google.maps, yandex.maps or native maps) using URL scheme.
for Google maps:
let appURL = URL(string: “comgooglemaps://”)
if UIApplication.shared.canOpenURL(appURL!) {
// code for open URL
print(“Can Open URL”)
}

MAC application deactivate when minimise or is in background

I am developing a mac application in which I am showing some count on app icon symbol (Similar to notification count). It work fine when app is in foreground and is active. But as an when I minimise the app or app goes into background. I am not able to see any message count on icon symbol.
let app = NSApplication.sharedApplication()
app.dockTile.showsApplicationBadge = true
app.dockTile.badgeLabel = String(unrdcount)
This method is called when I am getting data from a particular API. Can anyone suggest me how to let a particular API work for infinite time, so that if the application is ON user can get this unrdcount from API.

App to open in Spanish when participant clicks on Spanish Website in iOS

I have a project and this project support two languages English and Spanish.
If the user has Spanish languages selected phone, the app opens Spanish. The same cycle works for English also.
Second, We have a website and this website provides Spanish and English support. User can register ( Sign Up ) or login (Sign In)
from English site or Spanish site.
My question, As a User if I choose to register via the Spanish site, I should be taken to the app in Spanish and not English.
How can I do this? Universal Link or Deep Link. Is there anyone build this cycle previously?
You cannot change the device's language from within an app.
A solution for your use case could be to manually handle localization in your project: instead of relying on NSLocalizedString you'd have to use your own function for providing the localization for a given string/key. In the "normal" usage scenario you'd use the preferred language of the system; when opening the app via a link you'd add the language as URL parameter and use that language for the app session. (Note that this will not work with Storyboard or Info.plist localizations, only with texts you explicitly set in code).
Use Branch iOS SDK for deep linking so that you can ensure that a user receives the language even when they don't have the app installed before hand. In your links you should be able to set a field language to english, epanish, etc. When ever a user opens your application you can just pull that information out of the Branch callback like so.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:[UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// listener for Branch Deep Link data
Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
// do stuff with deep link data (nav to page, display content, etc)
print(params as? [String: AnyObject] ?? {})
let language = params?['language']
//Store this in their NSUserDefaults
let defaults = UserDefaults.standard.set(language, forKey: "language")
}
return true
}
The information in your UserDefaults will persist until the user deletes the app and reinstalls it.
let language = UserDefaults.standard.string(forKey: 'language')

ios app rejected on using AWS cognito implementation from mobile hub

We recently got our ios app rejected because of the following:
We noticed that the user is taken to Safari to sign in or register for an account, which provides a poor user experience.
however, the bit that launches the safari window for facebook/Google login is part of the AWSMobileHubHelper framework so we can't modify that code.
Any ideas/solutions would be greatly appreciated.
So I found a workaround. I just grab the GIDSignIn instance and change the properties myself. In case any one else wants to know how, all you have to do is:
Add a bridge header and import #import <GoogleSignIn/GoogleSignIn.h>
Implement the presentViewController method for GIDSignInUIDelegate on your main login controller
func signIn(signIn: GIDSignIn!, presentViewController viewController: UIViewController!) {
presentViewController(viewController, animated: true, completion: nil)
}
Edit demo login code to be something like this:
func loginWithGoogle(delegate: GIDSignInUIDelegate!) {
let googleProvider = AWSGoogleSignInProvider.sharedInstance()
// It is important that these are initialized after
// AWSGoogleSignInProvider.sharedInstance() is called
GIDSignIn.sharedInstance().uiDelegate = delegate
GIDSignIn.sharedInstance().allowsSignInWithBrowser = false
GIDSignIn.sharedInstance().allowsSignInWithWebView = true
handleLoginWithSignInProvider(googleProvider, callback: callback)
}
As of iOS 9 using Facebook SDK, this is expected behavior per Facebook login. Mobile Hub quickstart app is just applying the Facebook SDK 3 and using the APIs as directed. Check out the brief description below and read through the comments to get a better insight. This was not a popular decision by Facebook and others have provided workarounds (to forcing user authentication via mobile browser) if you wish to experiment. As for the AWSMobileHubHelper framework, we are looking into making this available at some point but don't have a timeline for this.
"Logic that automatically defaults people to the optimum experience for iOS 9. This means that the SDK dialogs for Facebook Login, Sharing across Facebook and Messenger, App Invites, App Events, or Native Like will automatically determine the best experience for people based on their device."
Source:
https://developers.facebook.com/blog/post/2015/09/10/new-SDK-for-iOS9/