1

Assuming I have my apk signed with the platform key and as part of the system:

My app has a widget, which I would like to place on the (system's default - Galaxy Tab P7500, Android 3.2) home screen right after starting the device fresh from factory reset - the same way as the Google Search widget is already there after you're doing a factory reset.

My question is: where exactly is it defined, which widget should be placed onto the home screen and at which position at factory reset time?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192
  • This is not possible from the SDK. Custom firmware might be able to do this. – CommonsWare Jun 20 '12 at 19:38
  • @CommonsWare Yes, I know it's not possible via SDK. But I'd like to know where in the lower level system I would need to tweak that; is there a config file, or the homescreen app sources? – Mathias Conradt Jun 20 '12 at 19:40
  • The home screen app sources would typically be from the device manufacturer, since they typically use their own home screen implementation. – CommonsWare Jun 20 '12 at 19:41
  • If you are building a custom rom then you should definitely check out the homescreen app. sorry i can't help you with a more precise answer. – DArkO Jun 20 '12 at 19:46
  • I've edited my question: I mean the vanilla home screen as it comes on Samsung Galaxy Tab P7500 Android 3.2. Wondering, where I'd hook my widget in, via configuration file somewhere in the system or needing to go into the homescreen code (if that's available), assuming I have access to the entire system - where shall I be looking at? – Mathias Conradt Jun 20 '12 at 19:49

1 Answers1

2

Look at AppWidgetService and /data/system/appwidgets.xml. It matches widget providers (apps) with widget hosts (launchers, etc.). Where exactly the widget appears is controlled by the launcher itself using the appWidgetId for reference. For the default launcher (on ICS), this is kept in the launcher.db database.

So if you add it to appwidgets.xml and give it an ID, then insert the proper row in the database, it should show up on the homescreen.

Nikolay Elenkov
  • 52,576
  • 10
  • 84
  • 84
  • kitkat doesn't have appwidgets.xml --- I'm working on a AOSP, and didn't check /data/system/... of course; I searched whole AOSP source for appwidgets.xml. Am I in right direction? – Dr.jacky Oct 25 '16 at 07:51