How to identify AppClips is launched by appclip card or by the user by searching the appclip in spotlight

277 Views Asked by At

I am working on an appclip, when I scan a QR code, appclip card gets shown and on click of open appclips gets launched and I performed a booking flow. Now next time if user comes to appclips using QR code, then I want to show an alert to user, that there is a booking already, however if he simply searches by spotlight and opens the app then dont display any alert.

Upon my debugging I found no way to identify whether appclip got opened by appclip card or by spotlight search. Please help. Thanks in advance..

1

There are 1 best solutions below

1
Andrei Soprachev On

Apple believes that launching from an app switcher is equivalent to launching through a card.

If a user returns to a previously launched App Clip from the App Library or Spotlight, the App Clip uses the invocation URL that it previously used to launch the App Clip.

https://developer.apple.com/documentation/app_clips/responding_to_invocations

I agree that this behavior is illogical and results in the app not working properly. I also faced this problem, maybe you found a workaround?