Dear Jake
★I have 2 point concern so could you please give me some information:
1. SDK version you used for widget
2. Please share xml manafiest file for your widget
★I successful receive Broadcat messsage BOOT_COMPLETED from system, so
currently i had 3 solution: Declare BroadcastReceiver in manifest file,
register BroadcastReceiver in implement of widget and try other trigger to
known timing to wake-up your implement. Could you please try implement above
and tell me result.
*
*Here is detail implement for earch solution:
*❶. Solution 1: Register BroadcastReceiver in Manifest:*
*●XML definition:*
<application
...................
<receiver
android:name=".YourWidget"
android:label="WidgetName">
<intent-filter>
<-- Declare list Intent you want to receive -->
<action
android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/your_layout_of_widget">
</meta-data>
</receiver>
.................
</application>
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
.................
*● *Ensure you had declare permission to receive BOOT_COMPLETED message:
(Ref.3)
RECEIVE_BOOT_COMPLETED
*●Disadvantage:*
Adroid docs said: some Broadcast receiver must register explicit in source
code:
Example: TIME_TICK, SCREEN_ON (Ref.2)
*●*I had try and successful receiver message from system on Android SDK 2.3,
And not sure this solution can work well on other SDK version.
*❷. Solution 2: Register BroadcastReceiver in implement of widget:* (Ref.1)
*●*Please refer my answer at this thread:
http://groups.google.com/group/android-developers/browse_thread/thread/790da1a655f4a227/0b8d6aad1dc2d371?hl=en&lnk=gst&q=Broadcast+Receiver+From+Widget#0b8d6aad1dc2d371
As you can see from the link above, i had successful register
BroadcastReceiver (ACTION_TIME_TICK), I use SDK 2.3.
*●*Advantage:
This solution is solver problem of Solution 1, explicit register
BroadcastReceiver
*●*Disadvantage:
Refer my note in provider link above
*❸. Solution3: Try other BroadcastReceiver to wake-up your implement like:*
ACTION_SCREEN_ON, ACTION_USER_PRESENT
*●Flow to receive message in boot process is:*
Boot completed -> [ACTION_BOOT_COMPLETED] -> Go to Keyguard screen ->
[ACTION_SCREEN_ON] -> Go to Home screen -> [ACTION_USER_PRESENT]
*●*So we still have at least 2 trigger which indicate timing need to update
your widget (I not sure except 3 message i list above, may be lack some
message, If you know have better BroadcastReceiver message plese let me
known
★Above is 3 solution i think can solver your problem. I had successful with
solution *❶* and* **❷* with Android SDK 2.3
Please try and give your feedback. If have any concern feel free to let me
known.
★References:
(1)
http://groups.google.com/group/android-developers/browse_thread/thread/790da1a655f4a227/0b8d6aad1dc2d371?hl=en&lnk=gst&q=Broadcast+Receiver+From+Widget#0b8d6aad1dc2d371
(2)
http://developer.android.com/reference/android/content/Intent.html#ACTION_TIME_TICK
(3)
http://developer.android.com/reference/android/content/Intent.html#ACTION_BOOT_COMPLETED
Regards,
DatNQ
On Fri, Feb 25, 2011 at 4:57 AM, Kostya Vasilyev <[email protected]> wrote:
> 25.02.2011 0:42, Jake Colman пишет:
>
> Hmmm. In Eclipse I am always doing Run/Run from the menu. I'd guess
>> that is what you are telling me NOT to do. So what do I do instead?
>>
>
> The first time (to install the app) do that.
>
> Then shut down the emulator.
>
> The second time, bring up the SDK/AVD manager by clicking its toolbar icon
> ("Android hiding in a box with an arrow pointing down", top left of the
> screen, in the menu bar), or from the Start menu, select your emulator,
> click "Start".
>
>
> --
> Kostya Vasilyev -- http://kmansoft.wordpress.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en