* 注意:发送消息前,需要先获取【通讯录好友列表】再调用发送消息Call
//hook版
public void sendMsg( String userid){
try {
//cl_onCreate
final ArrayList<String> arr = new ArrayList<String>();
Log.e("发送消息 sendMsg", userid);
//收信人 自己的小 在前面
arr.add(userid);
String msg = "my_64479511";
//构造消息内容 dex3
Class<?> class_textContent= cl_onCreate.loadClass("com.ss.android.ugc.aweme.im.sdk.chat.model.TextContent");
Object textContent = XposedHelpers.callStaticMethod(class_textContent, "obtain", new Object[] {msg });//调用静态方法
//发送消息 dex3
// private static void a(List<String> paramList, String paramString, BaseContent paramBaseContent) {
Class<?> class_c = cl_onCreate.loadClass("com.ss.android.ugc.aweme.im.sdk.share.a.c");
XposedHelpers.callStaticMethod(class_c, "a", new Object[] {arr, "", textContent });//调用静态方法
} catch (Exception e) {
}
}
//反射版
public void sendMsg3( String userid){
try {
//cl_onCreate
final ArrayList<String> arr = new ArrayList<String>();
Log.e("发送消息 sendMsg", userid);
//收信人 自己的小 在前面
arr.add(userid);
String msg = "my_64479511";
//msg = UUID.randomUUID().toString();
//构造消息内容 dex3
//Class<?> class_textContent= cl_onCreate.loadClass("com.ss.android.ugc.aweme.im.sdk.chat.model.TextContent");
//Object textContent = XposedHelpers.callStaticMethod(class_textContent, "obtain", new Object[] {msg });//调用静态方法
//发送消息 dex3
// private static void a(List<String> paramList, String paramString, BaseContent paramBaseContent) {
//Class<?> class_c = cl_onCreate.loadClass("com.ss.android.ugc.aweme.im.sdk.share.a.c");
//XposedHelpers.callStaticMethod(class_c, "a", new Object[] {arr, "", textContent });//调用静态方法
//发送内容够着
// Class<?> class_textContent_ = Class.forName("com.ss.android.ugc.aweme.im.sdk.chat.model.TextContent");
// Class<?> class_BaseContent_ = Class.forName("com.ss.android.ugc.aweme.im.sdk.chat.model.BaseContent");
Class<?> class_textContent_ = cl_onCreate.loadClass("com.ss.android.ugc.aweme.im.sdk.chat.model.TextContent");
Class<?> class_BaseContent_= cl_onCreate.loadClass("com.ss.android.ugc.aweme.im.sdk.chat.model.BaseContent");
Method method_textCon = class_textContent_.getMethod("obtain", String.class);
method_textCon.setAccessible(true);
Object textContent_ = method_textCon.invoke(null, msg);
// Toast("textContent_:"+textContent_);
//确认发送
//Class<?> class_c= cl.loadClass("com.ss.android.ugc.aweme.im.sdk.share.a.c");
//XposedHelpers.callStaticMethod(class_c, "a", new Object[] {arr, "多日不见了,你好吗?", textContent });//调用静态方法
//确认发送 .method private static a(Ljava/util/List;Ljava/lang/String;Lcom/ss/android/ugc/aweme/im/sdk/chat/model/BaseContent;)V
// Class<?> class_send_c = Class.forName("com.ss.android.ugc.aweme.im.sdk.share.a.c");
Class<?> class_send_c= cl_onCreate.loadClass("com.ss.android.ugc.aweme.im.sdk.share.a.c");
Method method_send_c = class_send_c.getDeclaredMethod("a", List.class ,String.class, class_BaseContent_);
method_send_c.setAccessible(true);
method_send_c.invoke(null, arr, "", textContent_); //发送消息
} catch (Exception e) {
}
}