1.0 KiB
1.0 KiB
#安卓
新建一个Activity活动类,继承自Activity
然后,可以 Override 一个 onActivityResult 接收回调的相关逻辑:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
//This is where you consume the respondent data returned by the SurveyMonkey Mobile Feedback SDK
//In this example, we deserialize the user's response, check to see if they gave our app 4 or 5 stars, and then provide visual prompts to the user based on their response
super.onActivityResult(requestCode, resultCode, intent);
if (resultCode == RESULT_OK) {
String respondent = intent.getStringExtra(SM_RESPONDENT);
} else {
SMError e = (SMError) intent.getSerializableExtra(SM_ERROR);
Log.d("SM-ERROR", e.getDescription());
}
finish();
}
其中finish指的是,接收到消息后,完成结束 该Activity 的生命周期
