Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Firebaseで解決するAndroidの機種依存 / Firebase solve and...

gyamoto
December 18, 2018

Firebaseで解決するAndroidの機種依存 / Firebase solve android device difference

gyamoto

December 18, 2018
Tweet

More Decks by gyamoto

Other Decks in Technology

Transcript

  1. 1. ػछ৘ใΛUserPropertyʹઃఆ val analytics = FirebaseAnalytics.getInstance(context) // ୺຤໊(ྫ: Pixel 3,

    SOV34, SC-01F, SHV39) analytics.setUserProperty("device_model", Build.MODEL) // ੡଄ऀ໊(ྫ: Google, Sony, samsung, SHARP) analytics.setUserProperty(“device_manufacturer", Build.MANUFACTURER)
  2. 3. RemoteConfigʹΑͬͯৼΔ෣͍Λม͑Δ val config = FirebaseRemoteConfig.getInstance() init { // ύϥϝʔλ͝ͱʹσϑΥϧτ஋Λઃఆ

    config.setDefaults( "advertise_power" to ADVERTISE_TX_POWER_MEDIUM.toLong(), "advertise_mode" to ADVERTISE_MODE_BALANCED.toLong() ) }
  3. 3. RemoteConfigʹΑͬͯৼΔ෣͍Λม͑Δ val config = FirebaseRemoteConfig.getInstance() // ઃఆ͞Εͨ஋ͷϑΣονɺ༗ޮԽ fun fetch()

    { config.fetch(cacheExpiration).addOnSuccessListener { config.activateFetched() } } val advertisePower: Int get() = config.getLong("advertise_power").toInt() val advertiseMode: Int get() = config.getLong("advertise_mode").toInt()