开发者

Android AppWidget and App Single Signon

I have an App and an AppWidget associated with it. The AppWidget is updated by an Update Service. What I want to implement is that the AppWidget only starts getting updates only when the User has logged in, much like the Facebook/Twitter Application and AppWidget functionality on Android. If the User is not logged in, the Widget will show "Please log in" or something. Is there a standard way to implement 开发者_C百科this functionality in Android?

Any help is much appreciated.


I dont know what is the standard procedure for doing this but I have done it using my own logic.

So I created a login/auth table for my app. When the user is logged in the loggedin flag in the table is set to 1.

The AppWidget Update service queries the SQLite DB table to check if the user is logged in. If the user is logged in then //do required to build RemoteViews update else build RemoteViews update to show default message "Please log in and stuff like that. It works fine and as I wanted. The updates start coming to the AppWidget once the user logs in and the Service finds the loggedin flag == 1.

Hope this helps others who are trying to do something similar.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜