Tieme
Tieme

Reputation: 65389

How to add AppClip to Siri's Nearby Suggestions?

In the video Configure and link your app clips Apple shows it's possible to have your AppClip being suggested by Siri based on the user's location.

I can't find this in the docs https://developer.apple.com/documentation/app_clips

Is this purely based on which location other users are using this app, or is this something a developer can configure (maybe based on a geocode region)?

iOS 14 - AppClip in Siri Nearby suggestions

Upvotes: 2

Views: 1782

Answers (3)

Ludyem
Ludyem

Reputation: 1919

The documentation doesn't go in specific details yet but from what you can read here: https://developer.apple.com/documentation/app_clips

and here https://developer.apple.com/documentation/app_clips/configuring_your_app_clip_s_launch_experience

under "Review Advanced App Clip Experiences"

You should be able to associate your app clip with a physical location, which will be available in AppStore Connect and with this set, Siri suggestions should be able to pick up your App Clip based on the user location

Upvotes: 0

Pranav Kasetti
Pranav Kasetti

Reputation: 9925

According to an Apple App Clips engineer I spoke to at WWDC, in order to get your App Clip published onto Apple Maps, you need to have a registered business registered with Apple. This can be done since iOS 10, via Apple Maps Connect, and registering as a small business.

The Nearby Siri suggestion is based on location data and only appears when your App Clip is associated with a place card on Apple Maps so you do not have control over this. It's definitely possible to get the user location after downloading the App Clips, as showed in the following demo but from your question I presumed you wanted to present the App Clip suggestion before downloading (isn't in the developer's control).

If you want to register an App Clip to a location, you need to wait till App Clips are fully usable and publishable on the App Store. When TestFlight and App Store Connect get support for app clips later this year, you'll be able to invoke an app clip from NFC, QR codes, Maps and more. So you would need to register your business with Apple, register your placecard in Apple Maps and then enable App Clips to get the suggestion.

Upvotes: 8

Grant
Grant

Reputation: 89

There is a sample code documentation page that has Widgets and App Clip in the code: https://developer.apple.com/documentation/swiftui/fruta_building_a_feature-rich_app_with_swiftui

In the link above in the App Clip code section, there is a payload that has latitude and longitude configurable. Siri should automatically suggest the App Clip based on the location you put in the latitude and longitude.

#if APPCLIP
func handleUserActivity(_ userActivity: NSUserActivity) {
    guard let incomingURL = userActivity.webpageURL,
          let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true),
          let queryItems = components.queryItems else {
        return
    }
    if let smoothieID = queryItems.first(where: { $0.name == "smoothie" })?.value {
        model.selectSmoothie(id: smoothieID)
    }
    guard let payload = userActivity.appClipActivationPayload,
          let latitudeValue = queryItems.first(where: { $0.name == "latitude" })?.value,
          let longitudeValue = queryItems.first(where: { $0.name == "longitude" })?.value,
          let latitude = Double(latitudeValue), let longitude = Double(longitudeValue) else {
        return
    }
    let region = CLCircularRegion(center: CLLocationCoordinate2D(latitude: latitude,
                        longitude: longitude), radius: 100, identifier: "smoothie_location")
    payload.confirmAcquired(in: region) { inRegion, error in
        if let error = error {
            print(error.localizedDescription)
            return
        }
        DispatchQueue.main.async {
            model.applePayAllowed = inRegion
        }
    }
}
#endif

The code snippet is from the documentation from link above.

Upvotes: 0

Related Questions