Skip to main content

Screenshots

Enable this option if you want all screenshots taken in the application to be automatically sent to your Crowdin project with tagged strings. This provides additional context for translators.

You can take screenshots and automatically upload them tagged to Crowdin in the following ways:

  • using the system buttons for taking a screenshot.
  • create your own handler (for example, clicking on some button in your application).
  • using the SDK Controls UI widget.

Setup

To enable the Screenshots feature, add the following code to the Application class:

override fun onCreate() {
super.onCreate()

Crowdin.init(applicationContext,
CrowdinConfig.Builder()
.withDistributionHash(your_distribution_hash)
.withScreenshotEnabled()
.withSourceLanguage(source_language)
.withAuthConfig(AuthConfig(
client_id,
client_secret,
request_auth_dialog
))
.withOrganizationName(organization_name) // required for Crowdin Enterprise
.withNetworkType(network_type) // optional
.withUpdateInterval(interval_in_seconds) // optional
.build())
}

// Using system buttons to take screenshots and automatically upload them to Crowdin.
Crowdin.registerScreenShotContentObserver(this)

Authorization

override fun onCreate(savedInstanceState: Bundle?) {
Crowdin.authorize(this)
}

Setting up own handler

If you want to set up your own handler for capturing screenshots, you can do it programmatically with a callback:

Crowdin.sendScreenshot(activity!!, object : ScreenshotCallback {
override fun onSuccess() {
Log.d(TAG, "Screenshot uploaded")
}

override fun onFailure(throwable: Throwable) {
Log.d(TAG, throwable.localizedMessage)
}
})
Tips
  • To use the Screenshots feature you still need to wrap context for your activities.
  • The OAuth App redirect URL should match your App scheme.
    E.g., for scheme <data android:scheme="crowdintest" /> redirect URL in Crowdin should be crowdintest://.
  • To easily control the Screenshots feature you could also use the SDK Controls UI widget.

Config options

Config optionDescriptionExample
withDistributionHashDistribution HashwithDistributionHash("7a0c1...7uo3b")
withScreenshotEnabledEnable Screenshots featurewithScreenshotEnabled()
withSourceLanguageSource language code in your Crowdin projectwithSourceLanguage("en")
withAuthConfigCrowdin authorization configwithAuthConfig(AuthConfig("client_id", "client_secret"))
client_id, client_secretCrowdin OAuth Client ID and Client Secret"gpY2yC...cx3TYB", "Xz95tfedd0A...TabEDx9T"
request_auth_dialogRequest authorization dialogtrue by default or false
withOrganizationNameAn Organization domain name
(for Crowdin Enterprise users only)
"mycompany" for Crowdin Enterprise or null for crowdin.com
withNetworkTypeNetwork type to be used for translations downloadAcceptable values are:
- NetworkType.ALL (default)
- NetworkType.CELLULAR
- NetworkType.WIFI
withUpdateIntervalTranslations update interval in seconds. The minimum and the default value is 15 minutes. Translations will be updated every defined time interval once per application loadwithUpdateInterval(900)
caution

Using the Crowdin.registerScreenShotContentObserver(this) (system button handler) to send screenshots to Crowdin requires storage permission for your application.