0

I'm trying to open a link in the browser from service. The problem is that if screen is off then link does not open. Sometimes the browser opens but without any data.

        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse("http://somelink.com"));
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(i);

If the screen is on then this code works very well. Why does not it work then screen is off?

karabara
  • 528
  • 6
  • 24

1 Answers1

0

Maybe this helps, but I don't know if it's good enought for services: https://stackoverflow.com/a/2201999/2151532

Community
  • 1
  • 1
loose11
  • 587
  • 4
  • 29