4

If you start my app you see a list of products, and if you select an item I open a product page.

Since some of my customers use the app always with the same product, I added a "add to homescreen" option to each product page. This creates a shortcut on the launcher. I did this according as described in this issue:

How can I have a home screen shortcut launch a dialog?

The shortcut works great, but I noticed that my app now has a "widget", that the user can add to the home screen from the installed app launcher. Doing so does not create a valid shortcut, because the information which product should be opened is not set this way.

I don't want this widget there in the first place, is there a way to create a shortcut without also adding the widget?

Community
  • 1
  • 1
bookwormat
  • 113
  • 9
  • I'm not aware of a way to do this, but you can possibly make the widget do something useful, such as opening a dialog with a list of products, so that the user can choose one and have it associated with the widget / shortcut when the widget is added to the homescreen, instead of doing the same thing through your app. In fact, this is a common way to do this: When the user puts the widget onto the homescreen, show a dialog to define what the widget will do, in your case which product to show when clicked. – Jonas Czech Sep 04 '15 at 15:12

1 Answers1

4

I'd recommend fixing the widget so you can create a shortcut to a product from there, in addition to the "Add to home screen" menu option. However if you don't want to do this simply remove the android.intent.action.CREATE_SHORTCUT intent-filter from the activity. You can still add a shortcut to the homescreen using the INSTALL_SHORTCUT permission with your existing method.

Kevin TeslaCoil
  • 10,037
  • 1
  • 39
  • 33