10000 Any way to smoothly filter supported devices? · Issue #9 · android/ai-samples · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Any way to smoothly filter supported devices? #9
Open
@Taewan-P

Description

@Taewan-P

Hello community! I have a quick question.

Is there a way to smoothly filter supported devices for this SDK?

I am trying to implement a feature that requires Gemini Nano, and I want the feature button to be disabled in unsupported devices.

I thought of filtering the device model names, but it would require an app update every time a new device is supported... and I do not want to implement it this way.

Edit: I am currently using the following code:

private fun checkAICoreAvailability(aiCore: PackageInfo?, privateComputeServices: PackageInfo?): Boolean {
    aiCore ?: return false
    privateComputeServices ?: return false
    val privateComputeMinVersion = "1.0.release.658389993"

    val aiCoreCondition = aiCore.versionName?.contains("thirdpartyeap") == true
    val privateComputeCondition = (privateComputeServices.versionName ?: "").padEnd(privateComputeMinVersion.length, '0') > privateComputeMinVersion

    return aiCoreCondition && privateComputeCondition
}

Metadata

Metadata

Assignees

No one assigned

    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

      0