N
N
Nikita Kargin2022-02-12 12:41:03
Android
Nikita Kargin, 2022-02-12 12:41:03

Why doesn't Async Task work on a real device?

There is the following project .
This is the application that starts the service. The service should send requests to the site.
I'm interested in the NetworkAsyncTask.kt file, which implements sending requests to the server via AsyncTask.
The problem is that the system works on the emulator (Android 9 OS) but does not work on the real Samsung Galaxy A51 (Android 11 OS). On a real phone, AsyncTask simply does not start (there is a line in the file,

Log.println(Log.INFO,"DebugInfo","Async Task Done")
, which says that the AsyncTask is running. The line is displayed in the emulator, but not on the real device)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay Savelyev, 2022-02-12
@Pakonigoosy

AsyncTask has not been used anywhere for more than five years already.
Not only that, it's already deprecated since API version >=30 (>= Android 11)
https://developer.android.com/reference/kotlin/and...
This is the first one.
Second. Somewhere since Android 8, there has been a tightening of the screws in the direction of background services. And in Android 11 they are twisted to the maximum

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question