LogoLogo
  • Welcome!
  • MOBILE SDK
    • iOS
      • SnapOdds Operator
        • Installation
        • Initialization
        • Snapping Games
        • Customization
        • API documentation
      • SnapOdds Sport Media
        • Installation
        • Initialization
        • Snapping Games and Presenting Odds
        • Customization
        • API documentation
    • Android
      • SnapOdds Operator
        • Installation
        • Initialization
        • Permissions
        • Snapping Games
        • Customization
        • API documentation
      • SnapOdds Sport Media
        • Installation
        • Initialization
        • Permissions
        • Snapping Games and Presenting Odds
        • Customization
        • API documentation
    • React Native
      • iOS Installation
      • Android Installation
      • SnapOdds Operator
        • Initialization
        • Snapping Games
        • Customization
      • SnapOdds Sport Media
        • Initialization
        • Snapping Games and Presenting Odds
        • Customization
  • Web SDK
    • JavaScript
      • SnapOdds Operator
        • Installation
        • Access Token Handling
        • Snapping Games
        • Customization
        • API documentation
      • SnapOdds Sport Media
        • Installation
        • Access Token Handling
        • Snapping Games and Presenting Odds
        • Customization
        • API documentation
      • Implementation Errors
  • Integration Guide
    • SnapOdds as Button
    • SnapOdds as Banner
Powered by GitBook
On this page
  • Implementation
  • Live Game Capture Code And Odds Display Code Example
  • Camera Permissions Required before Presenting Snap
  • Recommendations
  • Present Snap as a separate Activity
  • Limit to portrait

Was this helpful?

Export as PDF
  1. MOBILE SDK
  2. Android
  3. SnapOdds Sport Media

Snapping Games and Presenting Odds

PreviousPermissionsNextCustomization

Last updated 3 years ago

Was this helpful?

Implementation

  1. Ensure the SDK is initialized according to instructions listed in the section.

  2. Retrieve an Intent for displaying the SnapActivity with your desired (or the default) SnapConfiguration

  3. Start the intent for the SnapActivity

Live Game Capture Code And Odds Display Code Example

The following code illustrates a SnapActivity with the default configuration.

val intent = SnapActivity.intentForSportsMedia(this, SnapConfiguration();
startActivity(intent)

If you do not want or need to customize the snapping configuration, you can also omit the configuration parameter.

Once a sporting event is successfully snapped, the OddsResultsFragment is automatically presented in the SnapActivity and the odds for the snapped game are presented.

If the sporting event is not successfully snapped, the values above are not returned, and an error message will appear in the viewfinder: "Your snap returned no results. Make sure your TV is visible in the viewfinder"

Camera Permissions Required before Presenting Snap

Applications must request user permission for camera access, and camera access is required for the app to function. For this reason, your application should be set to ask permission from the user to access the camera, and to receive said permission, before presenting the Snap UI. The following code will set your application to request and receive permission prior to opening Snap UI:

val isGranted = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED
if (isGranted) {
    startActivity(Intent(context, MySnapActivity::class.java))
} else {
    requestPermissions(arrayOf(Manifest.permission.CAMERA), PERMISSION_REQUEST_CAMERA)
}

Recommendations

Present Snap as a separate Activity

It is recommended that you present the SnapFragment as a separate Activity.

Limit to portrait

Currently the Snap UI is only optimized for portrait orientation. It is recommended to present and limit the Activity containing a SnapFragment be limited to portrait orientation.

Android Initialization