-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
### [frp](https://github.com/fatedier/frp) 是一个专注于内网穿透的高性能的反向代理应用,支持 TCP、UDP、HTTP、HTTPS 等多种协议。可以将内网服务以安全、便捷的方式通过具有公网 IP 节点的中转暴露到公网。 | ||
|
||
### 当前frp版本号0.35.1 | ||
### 当前frp版本号0.39.1 | ||
|
||
### [编译方法](https://github.com/FrpcCluster/frpc-Android/blob/master/Compile_zh.md) | ||
|
||
### NDK version: 20.0.5594570 | ||
|
||
### [下载地址](https://www.pgyer.com/afrp) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.car.frpc_android; | ||
|
||
import android.app.ActivityManager; | ||
import android.content.Context; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.InputStreamReader; | ||
import java.util.List; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import frpclib.Frpclib; | ||
import io.reactivex.Completable; | ||
import io.reactivex.Observable; | ||
import io.reactivex.functions.Function; | ||
import io.reactivex.functions.Predicate; | ||
|
||
public class CommonUtils { | ||
|
||
|
||
public static Completable waitService(String serviceName, Context context) { | ||
return Completable.fromObservable(Observable.interval(0, 1, TimeUnit.SECONDS) | ||
.takeUntil(aLong -> { | ||
return isServiceRunning(serviceName, context); | ||
}) | ||
); | ||
} | ||
|
||
public static boolean isServiceRunning(String serviceName, Context context) { | ||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); | ||
List<ActivityManager.RunningServiceInfo> runningServices = am.getRunningServices(Integer.MAX_VALUE); //获取运行的服务,参数表示最多返回的数量 | ||
for (ActivityManager.RunningServiceInfo runningServiceInfo : runningServices) { | ||
String className = runningServiceInfo.service.getClassName(); | ||
if (className.equals(serviceName)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
public static Observable<String> getStringFromRaw(Context context, int rawName) { | ||
return Observable.create(emitter -> { | ||
BufferedReader reader = new BufferedReader(new InputStreamReader(context.getResources().openRawResource(rawName))); | ||
String line; | ||
StringBuilder result = new StringBuilder(); | ||
while ((line = reader.readLine()) != null) { | ||
result.append(line).append("\n"); | ||
} | ||
reader.close(); | ||
emitter.onNext(result.toString()); | ||
emitter.onComplete(); | ||
}); | ||
|
||
} | ||
|
||
|
||
} |
This file was deleted.