Skip to content

Supporting inactivity animation


Using Idle animation without audio

This will show prompt animation over Assistant if the user has not done any activity in the current screen. Inactivity time is customizable, allowing you to pass any value as per your application requirements.

@Override
public void assistantAvailable() {
    //offset is in milliseconds, thus 5000 here will be 5 seconds. 
    Zabaan.getInstance().promptIdleAnimation(5000);
}

Using Idle animation with custom audio file

If you want to play a custom audio file along with the inactivity animation you can use promptIdleAnimation(). This will play any audio file from the raw folder of your project.

@Override
public void assistantAvailable() {
//offset is in milliseconds, thus 5000 here will be 5 seconds.
    Zabaan.getInstance().promptIdleAnimation(5000, getRawUri("audio_file_name"));
}

This is a helper function to pick a given audio file resource from the raw folder of your project.

public Uri getRawUri(String filename) {
        int aVal = <*Your_Activity_Name*>.this.getResources()
                                            .getIdentifier(filename, "raw", this.getPackageName());
    return Uri.parse(String.valueOf(aVal));
}

Note: We recommend using this feature in assistantAvailable callback so that we can accurately map inactivity with Zabaan Assistant's availability on screen.

Back to top