简体   繁体   中英

Is there a way to share to the Google Classroom app if it's installed?

We provide a button in our app to share to Google Classroom using a URL which opens in the default browser, similar to this answer: https://stackoverflow.com/a/32460724/6257608

It would be preferable to launch and share directly via the Classroom app, if it's installed. Does google provide a way to do this, either via their SDK or an app specific protocol? (From what I can tell, the SDK doesn't support their sharing API.)

Basically you can do that.

See Apple Inter-App Communication chapter: Using URL Schemes to Communicate with Apps

Google seems to support it, I found in their Info.plist this:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>com.google.sso.900820440409-fbmgl9p4k9hlmkq01gjmjs2aiirbjaca</string>
    </array>
  </dict>
  <dict>
    <key>CFBundleURLName</key>
    <string>${BUNDLE_IDENTIFIER}</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>googleclassroom</string>
    </array>
  </dict>
</array>

So they have an URL-Scheme registered. I'm not familiar with the Google Classroom App. So I don't know, what type of data you can share. You can probably find it on the Internet. But you should be able to share data with this information.

How to get contents of Info.plist:

  1. Download the App on iTunes on your Mac.
  2. Use the Terminal to navigate to the download location.
  3. Rename the file to .zip (mv App.ipa App.zip)
  4. Extract the App.zip file via double click or terminal.
  5. Copy the Info.plist to some location (cp App/Payload/App.app/Info.plist ~/Desktop)
  6. See Info.plist

I hope this can help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM