Give my android app a widget option
My users are asking me to make one of m开发者_开发知识库y apps into a widget. Is there a way to ask if they want a widget in app and then add the widget to their home screen? I am having a tough time finding this on Google.
Edit: Is there add a widget option to an existing app or do I have to have to write a whole new program?
If you provide a home screen widget, it is up to the user to add it to his home screen. A very basic reason why you can't and shouldn't add programmatically a widget to the home screen is that you should select an empty space (if it is available), and it could not even ever being noticed by the user.
Update: there is absolutely no need to write a new program, you can (and should) implement all the widget code and requirements in the same package. This is the basic guide for widgets: http://developer.android.com/guide/topics/appwidgets/index.html
By "have them add it" do you mean
1.Tell the user that there is a widget and they can add it to the home screen?
this can easily be done by adding a note in your applications description in the Google play store or with the help of a toast message some where inside your application.
Toast.makeText(getApplicationContext(), " A widget is available and can be added" ,Toast.LENGTH_SHORT).long();
2 Add a widget to the home screen from within the your application ?
This is , as far as I am aware, is not possible.
hope this answers your question.
精彩评论