How should we put custom UIButton in google maps app? - 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(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.

Related

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()

How should we place custom button in google map?

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

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/

Open App From Widget IOS with Swift

How I can open my App from the Today Widget with Swift ?
I just want to pressed the Widget and than i would like to open my App.
I got right now a button on my whole view the button is clear.
But that don't work for me:(
I need Help:)
#IBAction func launchApp(sender: AnyObject) {
var url: NSURL = NSURL.URLWithString("AffordItLauncher://")
self.extensionContext?.openURL(url, completionHandler: nil)
}
In your info.plist you need to add the following:
And make sure that your app name is the same as the one in your url. In your case, it should be AffordItLauncher

Resources