-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
陈少平
committed
Jun 10, 2021
1 parent
5d53013
commit 453393e
Showing
11 changed files
with
122 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,39 @@ | ||
package com.quwan.tt.asmdemoapp; | ||
|
||
import android.app.Notification; | ||
import android.app.Service; | ||
import android.content.Intent; | ||
import android.os.AsyncTask; | ||
import android.os.Build; | ||
import android.os.IBinder; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.annotation.RequiresApi; | ||
|
||
public class A { | ||
@RequiresApi(api = Build.VERSION_CODES.Q) | ||
void test(){ | ||
new ThreadCheck().printThread("sAS"); | ||
AsyncTask asyncTask = new AsyncTask() { | ||
|
||
// Service service = null; | ||
// service.startForeground(0, new Notification()); | ||
|
||
BaseService baseService = new BaseService() { | ||
@Nullable | ||
@Override | ||
protected Object doInBackground(Object[] objects) { | ||
public IBinder onBind(Intent intent) { | ||
return null; | ||
} | ||
}.execute(); | ||
System.out.println("====>AsyncTask"); | ||
}; | ||
|
||
baseService.startForegroundIfNeed(0,new Notification(),true); | ||
|
||
// new ThreadCheck().printThread("sAS"); | ||
// AsyncTask asyncTask = new AsyncTask() { | ||
// @Override | ||
// protected Object doInBackground(Object[] objects) { | ||
// return null; | ||
// } | ||
// }.execute(); | ||
// System.out.println("====>AsyncTask"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.quwan.tt.asmdemoapp | ||
|
||
import android.app.Notification | ||
import android.app.Service | ||
import android.os.Build | ||
|
||
abstract class BaseService: Service() { | ||
|
||
fun startForegroundIfNeed(id: Int, notification: Notification, alwaysStart: Boolean = false) { | ||
if (alwaysStart || Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
startForeground(id, notification) | ||
} | ||
} | ||
|
||
} |
30 changes: 17 additions & 13 deletions
30
app/src/main/java/com/quwan/tt/asmdemoapp/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/quwan/tt/asmdemoapp/TestService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.quwan.tt.asmdemoapp; | ||
|
||
import android.app.Notification; | ||
import android.app.Service; | ||
import android.content.Intent; | ||
import android.os.IBinder; | ||
import android.util.Log; | ||
import androidx.annotation.Nullable; | ||
|
||
public class TestService extends Service { | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
Log.i("====>TestService:", "onCreate"); | ||
startForeground(0, new Notification()); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public IBinder onBind(Intent intent) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ plugins { | |
id 'maven-publish' | ||
} | ||
|
||
version = "1.0.2" | ||
version = "1.0.4" | ||
group = "com.tt.plugin.blackHook" | ||
|
||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters