Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
echo-adr-Deprecated
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
echo
echo-adr-Deprecated
Commits
162d2054
Commit
162d2054
authored
Jul 19, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first startup
parent
00d4ea80
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
18 deletions
+18
-18
build.gradle
app/build.gradle
+3
-3
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-5
HttpProxyService.java
app/src/main/java/com/virjar/echo/adr/HttpProxyService.java
+10
-5
StartOnBootBroadcastReceiver.java
...ava/com/virjar/echo/adr/StartOnBootBroadcastReceiver.java
+3
-4
echo-lib
echo-lib
+1
-1
No files found.
app/build.gradle
View file @
162d2054
apply
plugin:
'com.android.application'
android
{
compileSdkVersion
29
buildToolsVersion
"29.0.3"
compileSdkVersion
28
defaultConfig
{
applicationId
"com.virjar.echo.adr"
minSdkVersion
21
targetSdkVersion
2
9
targetSdkVersion
2
8
versionCode
1
versionName
"1.0"
...
...
@@ -45,6 +44,7 @@ dependencies {
implementation
'androidx.appcompat:appcompat:1.1.0'
implementation
'androidx.constraintlayout:constraintlayout:1.1.3'
//compile 'com.android.support:support-v4:24.2.0'
api
project
(
':echo-lib'
)
...
...
app/src/main/AndroidManifest.xml
View file @
162d2054
...
...
@@ -6,6 +6,7 @@
<uses-permission
android:name=
"android.permission.RECEIVE_BOOT_COMPLETED"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/>
<application
android:allowBackup=
"true"
...
...
@@ -48,11 +49,6 @@
<action
android:name=
"android.intent.action.MEDIA_UNMOUNTED"
/>
<action
android:name=
"android.intent.action.MEDIA_EJECT"
/>
</intent-filter>
</receiver>
<!--覆盖安装后唤醒service-->
<!--有些机器会报错-->
<receiver
android:name=
"com.virjar.echo.adr.StartOnBootBroadcastReceiver"
>
<intent-filter>
<action
android:name=
"android.intent.action.PACKAGE_REPLACED"
/>
<action
android:name=
"android.intent.action.PACKAGE_ADDED"
/>
...
...
app/src/main/java/com/virjar/echo/adr/HttpProxyService.java
View file @
162d2054
...
...
@@ -10,12 +10,12 @@ import android.graphics.BitmapFactory;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.IBinder
;
import
android.util.Log
;
import
androidx.annotation.Nullable
;
import
androidx.multidex.BuildConfig
;
import
com.virjar.echo.nat.client.EchoClient
;
import
com.virjar.echo.nat.log.EchoLogger
;
import
java.util.UUID
;
import
java.util.concurrent.atomic.AtomicBoolean
;
...
...
@@ -27,7 +27,6 @@ public class HttpProxyService extends Service {
private
EchoClient
echoClient
;
@Nullable
@android
.
support
.
annotation
.
Nullable
@Override
public
IBinder
onBind
(
Intent
intent
)
{
startService
();
...
...
@@ -89,14 +88,20 @@ public class HttpProxyService extends Service {
//TODO 设备ID生成算法
String
clientKey
=
UUID
.
randomUUID
().
toString
();
Log
.
i
(
"weijia"
,
"start EchoProxy front service"
);
EchoLogger
.
getLogger
().
info
(
"start EchoProxy front service"
);
//TODO 设置服务器信息
echoClient
=
new
EchoClient
(
"echo.virjar.com"
,
5698
,
clientKey
);
echoClient
.
startUp
();
new
Thread
()
{
@Override
public
void
run
()
{
//因为会访问网络,所以需要在新线程
echoClient
.
startUp
();
}
}.
start
();
}
}
app/src/main/java/com/virjar/echo/adr/StartOnBootBroadcastReceiver.java
View file @
162d2054
...
...
@@ -4,16 +4,15 @@ import android.annotation.SuppressLint;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.util.Log
;
import
com.virjar.echo.nat.log.EchoLogger
;
public
class
StartOnBootBroadcastReceiver
extends
BroadcastReceiver
{
@SuppressLint
(
"UnsafeProtectedBroadcastReceiver"
)
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
Log
.
i
(
"weijia"
,
"receive start service broadcast"
);
EchoLogger
.
getLogger
().
info
(
"receive start service broadcast"
);
context
.
startService
(
new
Intent
(
context
,
HttpProxyService
.
class
));
// clearAbortBroadcast();
}
}
echo-lib
@
e4a64e1d
Subproject commit
1e4d718969d9c279870925eb5587c1ac7e7e02a8
Subproject commit
e4a64e1d6ceea7e83da893c439ae1198aba1d73d
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment