Skip to content

identify().get() not complete #86

@LukasVykuka

Description

@LukasVykuka

Describe the bug
Call to identify().get() never return if it's called from another thread than main thread and app is on backgorund at the same time.

It should be possible to identify user without blocking main thread even if app is on background.

To reproduce
Make Android project and put this activity in it. Then create layout with run_button.

class MainActivity : AppCompatActivity(R.layout.activity_main) {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val ldConfig = LDConfig.Builder()
            .setMobileKey(API_KEY)
            .build()

        val ldUser = LDUser.Builder("1234").build()
        val ld = LDClient.init(application, ldConfig, ldUser).get()

        run_button.setOnClickListener {
            thread(start = true) {
                Log.d("LD", "delay")
                TimeUnit.SECONDS.sleep(3)

                Log.d("LD", "identify")
                ld.identify(LDUser.Builder("1234").build()).get()

                Log.d("LD", "completed")
            }
        }
    }
}

After cklick on run button you have 3 second to put app to background. Then observe logcat and you will see identify log but not completed log. If you click on button and don't put app to background then you will see both logs.

Expected behavior
Return from identify().get() method even if called from background thread if app is not in foreground.

SDK version
2.8.5

Language version, developer tools
Kotlin 1.3.50

OS/platform
Android

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions