SampleRate in Android app

How can I set the sample rate to be used by Juce in my Android application? I am sorry if this is something obvious, but I just don’t seem to be able to get it right.
Right now I am doing it like in this post, but this way AudioProcessor::prepareToPlay is called twice, once with some default sample rate and the next time with the sample rate I have set.
Is there a better way to set the sample rate?