How should we place custom button in google map? - ios

By clicking on a button am navigating to google maps app, and there am showing directions from one location to another location. Here is the code which i wrote in button
#IBAction func movetonextclass() {
if UIApplication.shared.canOpenURL(URL(string: "comgooglemaps://")!) {
let googleMapUrlString: String = "comgooglemaps://?saddr=&daddr=\(CDouble(reachLat)),\(CDouble(reachLong))&mode=driving"
UIApplication.shared.openURL(URL(string: googleMapUrlString)!)
}
else {
print("i wont go to google maps app, because in ur device there is no google maps app")
}
}
now am navigating to google maps app.
Here i would like to display a custom button in that screen.
Now, if i click on that button, i should navigate to my own app
how should i put a button in google maps screen? could any one help me with this

Related

Hide Activity Indicator when firebase authentication redirects to recapcha window (iOS - Swift)

I have implemented a Phone Authentication in my iOS app using Firebase, In that case, I have added an activity indicator to show a loading window. But, in some cases a ReCaptcha appears and, since the activity indicator is still in the window, the ReCaptcha cannot be completed, which makes the app freeze in one state.
Below is my code for login:
let activityIndicator = EAActivityIndicator()
activityIndicator.show()
Auth.auth().languageCode = "en"
PhoneAuthProvider.provider().verifyPhoneNumber(mobileNumber, uiDelegate: nil) { verificationId, error in
activityIndicator.hide()
if let error = error {
// handle error
} else {
self.navigationController?.pushViewController(ViewController(), animated: true)
}
}
As in the code, I show an activity indicator when the login button is tapped, if the mobile number is correct and if a 6 digit code is sent it will redirect to the Code entering View Controller. In certain cases, a ReCaptcha appears, but since the activity indicator is still on the screen, the ReCaptcha cannot be completed.
Screenshots:

How to return to today extension from app

When the user taps the today extension it opens the app where they can modify its settings. But when the app is exited, the user is returned to the home screen. Is there any way I return focus to the today extension so the user can view the changes immediately? Or is this just not possible in iOS?
I recommend making a button to go to the app. Or add transition functionality after applying settings.
like this
var instagramHooks = "instagram://user?username=johndoe"
var instagramUrl = NSURL(string: instagramHooks)
if UIApplication.sharedApplication().canOpenURL(instagramUrl!)
{
UIApplication.sharedApplication().openURL(instagramUrl!)
} else {
//redirect to safari because the user doesn't have Instagram
UIApplication.sharedApplication().openURL(NSURL(string: "http://instagram.com/")!)
}
User can click on the top left button to return if the application has been opened from another application. You can update the data on his return.

Pop up at bottom of screen when double tap home button. iOS, Swift

I have never seen this before and wondered how it would be possible to recreate. I have an app I am working on that uses maps.
This is from Shpok.
It shows a pop up at the bottom of the screen when double pressing the home button.
The app is simply creating an NSUserActivity and setting the mapItem property.
Something like:
let activity = NSUserActivity(activityType: "my.domain.activity.name")
activity.title = "Some Title"
activity.mapItem = anInstanceOfMKMapItem
activity.becomeCurrent()

Opening Instagram App in Swift, with a custom URL Scheme

There's a button in my project that opens Instagram when tapped. The problem is I need this button to open Instagram, and if the user was in the middle of editing a photo, it takes them right back to the photo editing tab.
With my code below, the button takes the user to Instagram's main feed. If they were in the middle of editing a photo, it clears that out.
Is there a custom URL scheme that will open Instagram, without 'erasing' any progress the user was currently working on? EG - writing their image description, or editing their image with filters.
// Instagram button pressed:
let urlStr: String = "instagram://app"
let url = URL(string: urlStr)
if UIApplication.shared.canOpenURL(url!) {
print("can open")
if #available(iOS 10.0, *) {
UIApplication.shared.open(url!, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(url!)
}
}
I also tried "instagram://" and "instagram://camera" - but the problem persists of clearing out the screen that the user was currently working on.
Thanks in advance
According to Instagram iPhone Hooks documentation, there is no URL scheme for editing a photo.
source : https://developers.facebook.com/docs/instagram/sharing-to-feed/

How should we put custom UIButton in google maps app?

By clicking on a button am navigating to google maps app, and there am showing directions from one location to another location.
here is the code which i wrote in button
#IBAction func movetonextclass() {
if UIApplication.shared.canOpenURL(URL(string: "comgooglemaps://")!) {
let googleMapUrlString: String = "comgooglemaps://?saddr=&daddr=\(CDouble(startLat)),\(CDouble(startLong))&mode=driving"
UIApplication.shared.openURL(URL(string: googleMapUrlString)!)
}
else {
let googleMapUrlString: String = "http://maps.google.com/maps?f=d,&daddr=\(CDouble(stopLat)),\(CDouble(stopLong))"
UIApplication.shared.openURL(URL(string: googleMapUrlString)!)
}
}
now i would like to display a custom UIButton in that screen.
if i click on that button, i should navigate to my own app
how should i put a button in google maps screen?
could any one help me with this
You cannot add anything in not your application, but actually from ios 9, when you open an another app when your app in active state you can back to previous application by tapping at the top left corner.

Resources