0

I wanna design an app that works in the background and fetches JSON data from an URL and if data was something specific app starts itself automatically.

I don't have any code because I searched around and found nothing.

is this even possible? and how should I proceed if yes?

Anthraxff
  • 148
  • 1
  • 13

2 Answers2

0

From android 10 you are not allowed to do that. They introduced a background process limit which restricts activities and services to be started only if there is an already running instance in the background.

https://developer.android.com/guide/components/activities/background-starts

Also see this for further info: https://stackoverflow.com/a/59421118/6694770

benyuss
  • 104
  • 1
  • 9
0

You can recreate your activity:

finish();
startActivity(getIntent());
Amirhosein
  • 4,266
  • 4
  • 22
  • 35