Android 接入阿里反馈 (基础版)

来源:互联网 发布:手机淘宝怎样帮人代付 编辑:程序博客网 时间:2024/05/13 21:32

1.去阿里加入百川,申请成为百川用户

2. 下载阿里反馈的lib包,将资源导入,添加依赖

3. 在application中注册你申请的appscreet

FeedbackAPI.initAnnoy(this,“你的appkey”);

4.进入反馈页面

private void initFeedBack() {    FeedbackAPI.Chat_Url = "https://h5.m.taobao.com/aliww/openim/fb.html";    String env = "online";    Map<String, String> uiCustomInfoMap = new HashMap<String, String>();    uiCustomInfoMap.put("env", env);    uiCustomInfoMap.put("pageTitle","用户反馈");    uiCustomInfoMap.put("hideLoginSuccess","true");    FeedbackAPI.setUICustomInfo(uiCustomInfoMap);    FeedbackAPI.setCustomContact("请输入您的手机号码", false);    /******     通过activity进入反馈页面        **************/  /*  String errorMsg = FeedbackAPI.openFeedbackActivity(this);    if (!TextUtils.isEmpty(errorMsg)) {        Toast.makeText(this, errorMsg, Toast.LENGTH_SHORT).show();    }*/    /*******    通过fragment进入反馈页面       ************/    Fragment fragment=FeedbackAPI.getFeedbackFragment();    FragmentManager fm=getSupportFragmentManager();    FragmentTransaction transaction=fm.beginTransaction();    transaction.replace(R.id.frame_content,fragment);    transaction.commit();}

5。通过uiCustomInfoMap还可以自定义更多的属性

 //enableAudio(是否开启语音 1:开启 0:关闭)
 //bgColor(消息气泡背景色 "#ffffff"),
 //color(消息内容文字颜色 "#ffffff"),
 //avatar(当前登录账号的头像),string,为http url
 //toAvatar(客服账号的头像),string,为http url
 //themeColor(标题栏自定义颜色 "#ffffff")
 //profilePlaceholder: (顶部联系方式),string
 //profileTitle: (顶部联系方式左侧提示内容), String
 //chatInputPlaceholder: (输入框里面的内容),string
 //profileUpdateTitle:(更新联系方式标题), string
 //profileUpdateDesc:(更新联系方式文字描述), string
 //profileUpdatePlaceholder:(更新联系方式), string
 //profileUpdateCancelBtnText: (取消更新), string
 //profileUpdateConfirmBtnText: (确定更新),string
 //sendBtnText: (发消息),string
 //sendBtnTextColor: ("white"),string
 //sendBtnBgColor: ('red'),string
 //hideLoginSuccess: true  隐藏登录成功的toast
 //pageTitle: (Web容器标题), string
 //photoFromCamera: (拍摄一张照片),String
 //photoFromAlbum: (从相册选取), String
 //voiceContent:(点击这里录制语音), String
 //voiceCancelContent: (滑到这里取消录音), String
 //voiceReleaseContent: (松开取消录音), String

0 0