|
|
@ -18,7 +18,10 @@ import android.widget.Toast; |
|
|
|
|
|
|
|
import com.example.myapplication.autoCtrlers.autoTkScriptServer; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
public class MainActivity extends Activity { |
|
|
|
|
|
|
@ -38,8 +41,11 @@ public class MainActivity extends Activity { |
|
|
|
public String videoId = "7063085154138459424"; |
|
|
|
// 私信内容从后台获取
|
|
|
|
String msgContext = "文字,此信息由“抖音涨粉宝app”发送。下载:http://www.szctyx.com/?from_id=123456"; |
|
|
|
// 初始化直播间任务列表 存放user_id和room_id
|
|
|
|
public List<Map<String, String>> liveRoomMissionList = new ArrayList<Map<String, String>>(); |
|
|
|
// 是否开启直播弹幕任务 方便调试
|
|
|
|
public boolean startLiveMission = true; |
|
|
|
// 私信所需短视频链接,拼接得来
|
|
|
|
|
|
|
|
String videoUrl = "snssdk1128://aweme/detail/".concat(videoId); |
|
|
|
|
|
|
|
private boolean checkAppInstalled(Context context, String pkgName) { |
|
|
@ -97,13 +103,13 @@ public class MainActivity extends Activity { |
|
|
|
if (b) { |
|
|
|
|
|
|
|
Intent intent = new Intent(); |
|
|
|
// 传入用户个人主页
|
|
|
|
//snssdk1128://webview?url=https%3A%2F%2Fhaohuo.jinritemai.com%2Fviews%2Fproduct%2Fitem2%3Fid%3D3478598732738653081 打开商品详情页
|
|
|
|
//snssdk1128://webview?url=https%3A%2F%2Fhaohuo.jinritemai.com%2Fviews%2Fproduct%2Fitem2%3Fid%3D 打开商品详情页
|
|
|
|
|
|
|
|
if(focusMissionList.length>0){ |
|
|
|
Integer temp_index = 0; |
|
|
|
String [] msgContentList = {}; |
|
|
|
for(String userId: focusMissionList){ |
|
|
|
// 传入用户个人主页
|
|
|
|
intent.setData(Uri.parse("snssdk1128://user/profile/" + userId)); |
|
|
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
|
|
|
Thread.sleep(5000); |
|
|
@ -147,7 +153,33 @@ public class MainActivity extends Activity { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(startLiveMission){ |
|
|
|
Integer temp_index = 0; |
|
|
|
boolean isSuccessed = false; |
|
|
|
String [] saySomthingWordsList = {"太值了吧", "爱了爱了", "这件衣服还有货吗?我要买三件!", "这家店的衣服还可以,我朋友的孩子穿好看!"}; |
|
|
|
// snssdk1128://live?room_id={undefined{room_id}}&user_id={undefined{user_id}}&u_code={undefined{u_code}}&from=webview&refer=web
|
|
|
|
// 将直播间任务数据赋值到map数组
|
|
|
|
Map<String, String> map = new HashMap<String, String>(); |
|
|
|
map.put("userId", "1987550452917454"); |
|
|
|
map.put("roomId", "7072542761229716231"); |
|
|
|
liveRoomMissionList.add(map); |
|
|
|
map = new HashMap<String, String>(); |
|
|
|
map.put("userId", "78913505358"); |
|
|
|
map.put("roomId", "7072628504071883534"); |
|
|
|
liveRoomMissionList.add(map); |
|
|
|
for (Map roomInfo: liveRoomMissionList){ |
|
|
|
intent.setData(Uri.parse(String.format("snssdk1128://live?room_id=%s&user_id=%s&from=webview&refer=web", roomInfo.get("roomId"), roomInfo.get("userId")))); |
|
|
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
|
|
|
|
|
|
|
isSuccessed = autoTkScriptServer.startMission(intent, saySomthingWordsList,4); |
|
|
|
|
|
|
|
temp_index += 1; |
|
|
|
if(temp_index< autoPrivateMsgList.length&&isSuccessed){ |
|
|
|
Log.d("myapp", String.format("第%d个直播间弹幕及转粉任务完成!", temp_index)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
Toast.makeText(MainActivity.this, "您未安装最新版抖音,请安装后再启动噢!", Toast.LENGTH_SHORT).show(); |
|
|
|