Is the Android system services listener localized in my application?

I am writing a spell check client using sample code in the SDK as an example. I have the following code (not the actual implementation, but the exact representation of the sample):

public class HelloSpellChecker implements SpellCheckerSessionListener {
    private SpellCheckerSession mSpellCheckService;

    private void bindService() {
        final TextServicesManager tsm = (TextServicesManager) getSystemService(
            Context.TEXT_SERVICES_MANAGER_SERVICE);
        mSpellCheckService = tsm.newSpellCheckerSession(null, null, this, true);
    }        

    public void getSuggestions(String word) {
        mSpellCheckService.getSuggestions(new TextInfo("tgis"), 3);
    }

    @Override
    public void onGetSentenceSuggestions(final SentenceSuggestionsInfo[] arg0) {
        Log.d(TAG, "onGetSentenceSuggestions");
        // Process suggestions
    }
}

I want to know if it will onGetSentenceSuggestionsonly start when my application calls getSuggestions, or will it start anytime the system service receives a request for getSuggestions?

If this is the last, what is the best way to ensure that my application only processes the offers he requested?

+4
source share

All Articles