Android服务工作流程

时间:2014-10-26 19:41:45

标签: android service

我正在尝试在android中创建一个简单的REST客户端,我创建了建立连接和服务意图的客户端。我可以从主要活动中调用它,但是我在将服务意图的结果从活动中获取时遇到了问题。我怎么能做到这一点?我对如何处理这个问题感到困惑......

@Override
protected void onHandleIntent(Intent intent) {
    if (intent != null) {
        final String action = intent.getAction();
        if (ACTION_AUTH.equals(action)) {
            final String username = intent.getStringExtra(EXTRA_PARAM_USERNAME);
            final String password = intent.getStringExtra(EXTRA_PARAM_PASSWORD);
            boolean authenticated = handleActionAuth(username, password);
            Log.d(TAG, "Result: "+authenticated);
            /*** What can i call here to notify the activity??? ***/
        } else if (ACTION_BAZ.equals(action)) {
        }
    }
}

0 个答案:

没有答案
相关问题