Search code examples
androidcontrollerscoreloop

android usage of "controller.query(activity);" in scoreloop


i am attempting to implement a built in controller that is part of the scoreloop library. the documentation states:

Basic Usage:

To invoke the TOS dialog if it was not accepted previously, the following code may be used:

 final TermsOfServiceController controller = new TermsOfServiceController(new TermsOfServiceControllerObserver() {
 @Override
 public void termsOfServiceControllerDidFinish(final TermsOfServiceController controller, final Boolean accepted) {
    if(accepted != null) {
        // we have conclusive result.
        if(accepted) {
            // user did accept
        }
        else {
            // user did reject
        }
    }
 }
 });
 controller.query(activity);

but when i paste this into my code i get the following syntax errors:

Syntax error on token(s), misplaced construct(s) Syntax error on token "activity", VariableDeclaratorId expected after this token

am i using this incorrectly? how and where would this be used any ideas?

EDIT: after moving the statement to the method where i want to show the dialog i now get the following error:

new error


Solution

  • You seem to be calling controller.query(activity) in a class body where a declaration is expected. Move the statement controller.query(activity) to a method where you would like to show the dialog.