Accessing the time within live wallpapers
I've developed a 开发者_如何学编程live wallpaper. Now I want it to connect with the net to get the exact time, so the live wallpaper changes according to it. But, being an amateur, I'm not able to do it. Please help.
Suggest using local system calls; no need to access Internet. Take a look at PolarClock, for example, to see some code using time-related classes: https://android.googlesource.com/platform/packages/wallpapers/Basic/+/master/src/com/android/wallpaper/polarclock/PolarClockWallpaper.java
Edit: There are two good reasons why you do not want to use the Internet to get the time:
- When the wallpaper is installed, the user will have to authorize Internet access. They may wonder why you want to do this when by rights it is unnecessary.
- Your wallpaper will not function if Internet access is unavailable.
精彩评论