0

How to create a simple widget that locks the screen without an Activity, only in an AppWidgetProvider?

I've tried this solution but the method getSystemService does not exist out of an Activity context.

Thank you very much for every clarifications.

Valerio Bozz
  • 1,176
  • 16
  • 32

1 Answers1

0

Call getSystemService() on the Context passed into onReceive().

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • OK thanks... But now I've problem with the method `startActivityForResult` that he cannot find. Ideas? – Valerio Bozz Sep 01 '14 at 12:47
  • @ValerioBozz: That part you have to do from an activity. There is no option for `startActivityForResult()` from anything other than an activity. – CommonsWare Sep 01 '14 at 12:48