添加云宝云测试接口

This commit is contained in:
ZhanGSKen
2025-06-04 11:21:26 +08:00
parent b0388a2972
commit 4842a1ec30
8 changed files with 108 additions and 5 deletions

View File

@@ -103,6 +103,8 @@
</receiver>
<activity android:name="cc.winboll.studio.libappbase.activities.YunActivity"/>
</application>
</manifest>
</manifest>

View File

@@ -0,0 +1,68 @@
package cc.winboll.studio.libappbase.activities;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.R;
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
/**
* @Author ZhanGSKen<zhangsken@188.com>
* @Date 2025/06/04 11:06
* @Describe 云宝云
*/
public class YunActivity extends Activity implements IWinBoLLActivity {
public static final String TAG = "YunActivity";
@Override
public Activity getActivity() {
return this;
}
@Override
public String getTag() {
return TAG;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_yun);
}
public void onTestYun(View view) {
LogUtils.d(TAG, "onTestYun");
(new Thread(new Runnable(){
@Override
public void run() {
testYun();
}
})).start();
}
void testYun() {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://yun.winboll.cc/backups/")
.build();
try {
Response response = client.newCall(request).execute();
if (response.isSuccessful()) { // 状态码 200-399 均视为成功
//System.out.println("OK");
LogUtils.d(TAG, "OK");
} else {
//System.out.println("请求失败,状态码:" + response.code());
LogUtils.d(TAG, "请求失败,状态码:" + response.code());
}
} catch (Exception e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
}
}

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TestYun"
android:onClick="onTestYun"/>
</LinearLayout>
</LinearLayout>