0

I created an app with widget, When test my app in emulator with android 2.2 everything works fine, but in my galaxy s device with android 4.2 my widgets doesn't shown in widgets area!! Whats the problem?

Fcoder
  • 9,066
  • 17
  • 63
  • 100
  • You made an error. If you want a more detailed answer, you really need to provide more details! – Veger Jan 03 '13 at 12:19
  • i say, how can this happen? in emulator my widgets loads correctly but in android 4+ in real device not... give me some possible reasons. please – Fcoder Jan 03 '13 at 12:34

1 Answers1

3

Try this:

Step #1: Add an activity to your app.

Step #2: Launch that activity from the home screen launcher.

Step #3: Then go look for your app widget.

BroadcastReceivers are disabled on Android 3.1+ until a component (e.g., an activity) has been directly invoked (e.g., run from the launcher). AppWidgetProvider extends BroadcastReceiver. Depending upon the home screen implementation, this may mean that your app widget will not appear in the list of app widgets until a a component has been directly invoked.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • i have a lot of activities in my project. my app work finely but only widgets not... – Fcoder Jan 03 '13 at 16:49
  • @FarhadShirzad: Then I do not have an explanation for the behavior that you are seeing. If you somehow create a sample project that reproduces the behavior (app widgets work on earlier versions but not on Android 4.x, even after launching an activity), post it somewhere, and I'll try to take a peek at it. – CommonsWare Jan 03 '13 at 16:52