How does Google launch the AR Animals ARCore app from a browser link? - arcore

TL;DR;
Google's new AR animals appear as if they are AR on the web (like AR.js or 8thWall), but are actually native ARCore applications. The sleight of hand is that a link in a browser (actually a button with a very obfuscated event handler chain) launches the ARCore app itself without any prompt for the user to install anything. How does Google do this? I want to do it too.
Detail
Recently Google introduced a search feature that allows users to view animals in AR by clicking a link from a search info card.
This is true plane-sensing, SLAM-tracking AR, no markers required. Viewing examples on my own phone (Pixel 2 running Android 9), the location and angle fidelity is impressive. I can move the phone around, walk around, and the tiger's foot (for example) stays anchored within a few inches. Likewise the AR objects have excellent visual stability, avoiding the shake that plagues most of the marker-based AR.js apps I've seen, or the mediocre object anchoring I see in 8th Wall's non-marker examples.
As a developer working on AR delivered over the web, I'm mighty curious how they pulled off such a high-quality result. Do they have far superior proprietary tech they're not sharing with the THREE.js / ARKit / AR.js open source projects?
No. Debugging into the the tiger example using USB remote inspection of my phone from my laptop, plus some circumstantial clues, I've concluded that they look so good because they are not web AR, but native AR using ARCore. Somehow Google causes the user's phone to load a native ARCore application (system logs make it appear is ARCore itself is being launched as an application) without any install prompt. Attempting to switch to another app causes the AR app to automatically close, making it difficult to debug or inspect it.
Google's own ARCore docs generally imply that you need to publish an app to the Play store to actually get ARCore enabled software into the hands of users. So, does anyone know how Google does what they're doing here?
All images are my original work
Info card link:
Prompt to grant app permissions to ARCore:
ARCore was just used:

https://developers.google.com/ar/develop/java/scene-viewer
Scene Viewer is an immersive viewer that enables AR experiences from your website. It lets Android mobile device users easily place, view, and interact with web-hosted 3D models in their environment.
To do this, all a user needs is an Android device that has ARCore 1.9 or later. Most Android browsers are supported, and no programmatic integration with a browser is necessary -- only properly-formatted links on a web page.
<model-viewer ar alt="A 3D model of an astronaut." src="Astronaut.gltf"></model-viewer>
Thanks for posting this question. :) I was waiting for this feature but I didn't know when it came out.

It works by using Android's intent URLs.
intent://arvr.google.com/scene-viewer/1.2?file=https://storage.googleapis.com/ar-answers-in-search-models/static/GiantPanda/model.glb&title=Giant%20panda&referrer=google.com:ANIMALS:kp_carousel&sound=https://storage.googleapis.com/ar-answers-in-search-models/static/GiantPanda/Bear_Panda_Giant_Unisex_Adult.ogg&card_content=https://arvr.google.com/searchar/infocard?data%3DCg0vZy8xMWo1ZjVkbms0EAE%26hl%3Den-US&share_text=See%20a%20life-sized%20animal!%20Search%20%22Giant%20panda%22%20on%20Google%20and%20tap%20%22View%20in%203D.%22%20https://www.google.com/search?q%3DGiant%2Bpanda%26hl%3Den-US%26stick%3DH4sIAAAAAAAAAFPi0M_VNzBOyjJ8xGjMLfDyxz1hKa1Ja05eY1Th4grOyC93zSvJLKkUEuNig7J4pLi44Jp4FrFyu2cm5pUoFCTmpSQCADr-Ul5OAAAA#Intent;package=com.google.android.googlequicksearchbox;scheme=https;S.browser_fallback_url=https://arvr.google.com/scene-viewer?file=https://storage.googleapis.com/ar-answers-in-search-models/static/GiantPanda/model.glb&title=Giant%20panda&referrer=google.com:ANIMALS:kp_carousel&sound=https://storage.googleapis.com/ar-answers-in-search-models/static/GiantPanda/Bear_Panda_Giant_Unisex_Adult.ogg;end;
Skip to the end for a generator.
Let's break down the URL format.
intent:// Ok, this is an Android Intent URL
arvr.google.com/scene-viewer/1.2?[parameters] This is the URL that will be passed to the ARCore app. The parameters apper to work as follows:
card_content: This is the link to a webpage to show on the info sheet at the bottom of the AR view.
file: This is the 3D model file, in glb format.
referrer: Not sure what this is for, tracking probably.
share_text: This sets the text to share when you click the share button.
sound: An audio file to play, in ogg format.
title: The model's name, shown in the title of the info sheet at the bottom.
#Intent; Alright now we are getting to the part where we tell Android where to open the link.
package=com.google.android.googlequicksearchbox; Interesting. This opens in the Google app, not the ARCore app. Google has a habit of sticking random things in the Google app, and I guess this is one of them.
scheme=https; This means that the URL at the beginning should be passed to Google as an https:// URL.
S.browser_fallback_url=https://arvr.google.com/scene-viewer?[parameters] This URL will be opened if the user doesn't have the Google app.
file: See above.
title: See above.
sound: See above.
referrer: See above.
;end; The end of the URL is here.
urlform.oninput=()=>{
out.textContent=`intent://arvr.google.com/scene-viewer/1.2?file=${encodeURIComponent(file.value)}&title=${encodeURIComponent(title.value)}&referrer=&sound=${encodeURIComponent(sound.value)}&card_content=${encodeURIComponent(card.value)}&share_text=${encodeURIComponent(share.value)}#Intent;package=com.google.android.googlequicksearchbox;scheme=https;S.browser_fallback_url=https://arvr.google.com/scene-viewer?file=${encodeURIComponent(file.value)}&title=${encodeURIComponent(title.value)}&referrer=&sound=${encodeURIComponent(sound.value)};end;`
}
#urlform{
display:grid;
grid-gap:9px;
}
<form id="urlform">
<input type="text" placeholder="URL of model file (GLB)" id="file">
<input type="text" placeholder="Model name" id="title">
<input type="text" placeholder="URL of sound file (OGG)" id="sound">
<input type="text" placeholder="URL of card webpage (HTML)" id="card">
<textarea placeholder="Share text" id="share"></textarea>
</form>
<div id="out"></div>

Related

How to download a 3D model from a website and load content into ios app using Swift

Can someone explain the process involved to allows users of my app to visit a website using Safari to download 3D models and subsequently launch the app for the users to view the models. I am currently working with Scenekit to visualise 3D models that have been pre-loaded at build time, however I would like users to be able to access 3D files dynamically after they have uploaded them to my website. After some initial research, I believe Universal links may direct me in the right direction, however I cannot find a suitable source that supports downloading files using these links. An example of the desired functionality is below (screenshot taken from another app).
The user visits the website and downloads the 3D model.
After pressing the download button, an alert pops up and allows the user to launch the app. In doing so, the 3D model is downloaded into the app.
Thank you in advance.
You can use for it Universal Links, or Deeplink. iOS will detect this action and offer to you open in app. But remember, app MUST be installed on your device, otherwise it goes to AppStore to find your app.
So u can put into download URL your 3D model and send it by Universal Link.
Here is documentation from Apple how to use it.
https://developer.apple.com/documentation/uikit/inter-process_communication/allowing_apps_and_websites_to_link_to_your_content

What are the default Apple URL schemes for the default apple apps?

I am trying to track down these URLs because I would like to integrate them with the Shortcuts (previously workflow) app. My end game is to make queries that will perform certain functions that I can call from a google home device. In simpler terms, I want to make google home more "Apple friendly."
I have not found anything that is too current out there on the URL schemes. I saw that sending a SMS message was triggered with sms://<PhoneNumber> , but I am not sure how up to date that information is.
I plan on adding features to search Apple Music (by triggering a workflow). I am also planning on adding text message features.
I am also looking into making an app for google home, but I still am in the learning stage with that. Any advice on making google home more Apple friendly would be greatly appreciated.
This is a constantly changing list given the number of features being added or third-party apps. Here's a list that does a good job of staying up-to-date: https://ios.gadgethacks.com/news/always-updated-list-ios-app-url-scheme-names-0184033/

Clarification on Apple App Store Guidelines - Use of WebUIView

I'm new to mobile programming. Recently my company has looked into creating a specific application for tablets (Android and iOS). So it was assigned to me to develop a thin-client based around using HTML5 for what we need to do.
Essentially the application allows a user to fill in a custom-designed form (which the user can build themselves, or pull down a predefined template from our server). This form is built using HTML5, Javascript, JQuery, etc. Some additional functionality is planned, such as being able to take a picture using the native device and attach it to the form that we send back to our server for storage (once we figure out how to do it in iOS. We've already done it in Android.)
However, I noticed the following on Apple's App Store Guidelines, under the Functionality section. Item 2.12:
Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected
Can someone explain, or at least direct me to clarification of this when using the UIWebView construct? This application at its core is pretty much just HTML5. While it might have some additional bells and whistles, does this mean that if we try to submit this (when its completed) to Apple, that they will simply reject it out of hand? Implementing the majority of it in HTML5 was done purposely so we wouldn't have to re-code everything from device to device (and we will also embed it in one of our products, so if they want to fill it out on the desktop while in our system, they can.)
Any guidance would be appreciated, or even suggestions of where this question should be asked if SO is not the proper forum for it. Thanks again.
The key in the Appstore guideline is the word "simply":
Apps that are not very useful, unique, are simply web sites bundled as
Apps
If you keep a balance between locally stored and remote HTML content for your webviews Apple would not look at the app as a hollow shell pulling in remote content.

How to test Twitter Cards?

I am setting up Twitter Cards using a player card. It works in the preview tool, but the docs say it needs to be tested "on twitter.com modern desktop browser? Native iOs & Android Twitter app? mobile.twitter.com iOS & Android default browsers?"
How can I test it on twitter.com and twitter mobile apps if it hasn't been approved it?
Twitter have added a Card Validator. Not sure if this will help you, but it might help others who land on this page from a Google search.
https://cards-dev.twitter.com/validator
I too had this same question which was unanswered on the Twitter Developer Forum. I was able to get a player card URL validated and have my domain white-listed without first reviewing in each different context.
Make sure your URL meets the Player Card requirements (https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started). My twitter:player entries point to a simple html page which contains a VideoJS player, my content is defined so it resizes to 100% width and height (so that the small mobile web experiences won't experience cropping.) Of course all assets must be fetched via https like defined in the docs.
The Player Card should really help with video/channel views for those that have a large Twitter following.
Good luck,
Stan

Opening deep content links in native apps from mobile web

My company has an app (iOS and Android), to which the following scenarios applies. I'm trying to help point my engineers and product team in the right direction.
When one of our users clicks on a content link from one of our emails, or Tweets or Facebook posts, and they're on their mobile device, we prompt the user with a link to download our app. This is similar to what many apps do, including LinkedIn (see i.stack.imgur.com/glSgJ.png).
I imagine this is mildly effective of driving awareness and downloads of a native app, for new users who came in from social media and various web sources. However, it is not helpful at all for a user like me who already has the app!
1) clicking "No Thanks" keeps me on the mobile web (when I want to be in the native app), and
2) clicking "Download the App" takes me to iTunes App Store page for an app I already own.
SUPER ANNOYING. As a result, I have to manually open the app, and search for the content in question. I'm guessing most users don't do this. More importantly, depending on the UI/UX of the app, I may never get there!
Again, I know we are handling mobile web visits in the same way many other companies (including LinkedIn) do, but it seems we are leaving a lot of potential native app use on the table. I want our engineers to build that elusive 3rd option, "Open In App".
Spotify and Rdio have solved this very nicely. Here are deep content links (in the case of these companies, to a specific song) for the two apps respectively:
http://open.spotify.com/track/2SldBUTJSK6xz43i8DZ5r2
http://rd.io/x/QF3NK0JKWmk
If you have a moment, first grab the free version of Rdio or Spotify apps. Then, if you open those links above from an iOS device, you will see how nice the experience is, for existing native app users: Rdio has a nice "Tap to open in Rdio" link (http://i.stack.imgur.com/B7PuE.png), and Spotify's link is even more clear, "I have Spotify" (http://i.stack.imgur.com/Q3IV6.png). Both apps also include a link to download the app, for new app users. More importantly, both apps cookie the user: future visits to links (whether from email, Twitter, Facebook, etc) on mobile web automatically open the app, instead of prompting you to choose each time. SUPER CONVENIENT.
Questions:
1) How do they accomplish this? I'm initially only concerned about iOS (on which I tested this), but this same situation should apply to Android.
2) Why aren't more apps doing this? It doesn't seem like rocket science, so am I missing a key reason why this might be a bad idea? Half of my problem is convincing the use case.
3) Why don't I see discussions about this technique? I've searched a ton for an iOS solution. I come up with a lot of discussion about URL registrations (mainly app-to-app), but no one actually referring to the type of scenario I describe (mobile web prompt to open native app).
It seems that with minimal engineering, app developers could dramatically increase native app use, converting from mobile web. :)
Android supports deep linking. Please refer to
http://developer.android.com/training/app-indexing/deep-linking.html
Tapstream's deferred deep links can send users to specific views within apps (iOS only), even when the app isn't yet installed on their device.

Resources