Android App standard with widget
I have an app that starts 开发者_StackOverflowwith the OS and it might or might not be active dependending on user actions performed later on. Of course this app, has a number of activities and one of them has been defined as entry point in the android-manifest.xml file
<activity android:name=".PrincipalActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Now I would like to give the user the choice to add a widget on his/her desktop for showing only relevant information about my app, which is (or should be) running in the background.
Q1: is it possible to add a widget to this same app?
Q2: can I invoke my app from the widget?
I tried adding a widget following the tutorials for widget but it didn't work so far.
Yes it is possible to add a widget to the app. You simply need to define the Widget in your android manifest. I don't know if you saw this but here is some good reference: http://developer.android.com/guide/topics/appwidgets/index.html
Yes you can invoke your app from the widget. Here's a post about it: Launching activity from widget
You do need to read the FAQ about asking questions here, though. Here are a couple ways to improve your question:
Provide specific questions about specific problems, not broad questions about how to do something major.
If you tried something and it didn't work, please explain what the result was and what the expected result was, posting any errors you may have received.
精彩评论