So I just ran into this same type of issue when trying to get the PWA 
working with an Android application. What's extremely frustrating to me is 
the whole state of Google's photo/video API, or really the lack thereof. 
They're clearly trying to migrate to Google+ from Picasa Web Albums, yet 
they provide no Google+ API to access photos. There's also no mention in 
the documentation that the gdata Java client is incompatible with Android, 
at least that I saw. And finally, even if we use the google-api-java-client 
as you suggest, for the older APIs like PWA we have to write our own code 
to parse the underlying gdata XML anyway. It just seems ludicrous that 
there's no documented best practice for accessing your Google+/Picasa web 
photos from Google's own platform (Android).

Anyway, here's a simple hack I just got working for PhotoEntry that you can 
probably use for AlbumEntry as well:

String sUrl = PICASA_API_URL + "/user/" + mUsername + "/albumid/" 
+params.getAlbumId();
try {
URL feedUrl = new URL(sUrl);
AlbumFeed feed = mPicasaService.getFeed(feedUrl, AlbumFeed.class);

for (GphotoEntry photo : feed.getEntries()) {
String sPhotoId = photo.getId();

//HACK to get a PhotoEntry, since the feed object won't admit it has any on 
Android
PhotoEntry p = new PhotoEntry(photo);
String sPhotoUrl = p.getMediaContents().get(0).getUrl();
 //Do whatever you want with PhotoEntry
}



On Wednesday, January 9, 2013 11:28:05 AM UTC-6, Mike Erickson wrote:
>
> Hello,
>
> I looked into this issue on a previous occasion for a different user, and 
> I can tell you what I told them. Essentially, these APIs were not designed 
> to work on Android, and they don't work on Android as you have experienced 
> above.
>
> That said, you might be able to get it to work using one of these:
>
> 1. Include the source code for the java client library directly in your 
> project. You'll still need to include the extra external jars needed with 
> the client library (mail.jar, activiation.jar) but that might work.
> 2. Use the google-api-java-client. They claim to have an example with the 
> picasa API that works on Android, although I couldn't get it to work on my 
> side. http://code.google.com/p/google-api-java-client/
> 3. Don't use a client library, or use a client library to handle 
> authentication and then write your own fetcher (just send a request to the 
> URL you want, and parse the incoming json or XML). 
>
> I would recommend strongly option 2 if you can get it work, or option 3 if 
> you can't. It's a little more work to get away from the client libraries, 
> but you'll have great freedom.
>
> Sorry I couldn't be of more help.
>
>  
> Michael Erickson | Photos APIs |  meri...@google.com <javascript:> |
>  424-666-1024
>
>
>
> On Wed, Jan 9, 2013 at 7:17 AM, Joshua Park <jinyoun...@gmail.com<javascript:>
> > wrote:
>
>> Here's my entire source code (for Android). I don't know what I am doing 
>> wrong.
>>
>> public class MainActivity extends Activity {
>>
>> PicasawebService service;
>>  @Override
>> protected void onCreate(Bundle savedInstanceState) {
>>  super.onCreate(savedInstanceState);
>> setContentView(R.layout.activity_main);
>> service = new PicasawebService("test");
>>  new Thread() {
>> @Override public void run() {
>> try {
>>  String uname = "em...@gmail.com <javascript:>";
>> String password = "(password)";
>>  service.setUserCredentials(uname, password);
>> URL feedUrl = new URL("
>> https://picasaweb.google.com/data/feed/api/user/default?kind=album";);
>>  Query albumQuery = new Query(feedUrl);
>> UserFeed myUserFeed = service.getFeed(feedUrl, UserFeed.class);
>>  for (AlbumEntry entry : myUserFeed.getAlbumEntries()) {
>> Log.v("test", entry.getGphotoId() + ":" + entry.getTitle().getPlainText() 
>> );
>>  Log.v("test", entry.getGphotoId() + ":" + 
>> entry.getSummary().getPlainText() );
>> }
>>  for (GphotoEntry entry : myUserFeed.getEntries()) {
>> Log.v("test", entry.getGphotoId() + ":" + entry.getTitle().getPlainText() 
>> );
>>  Log.v("test", entry.getGphotoId() + ":" + 
>> entry.getSummary().getPlainText() );
>> }
>>  } catch (AuthenticationException e) {
>> Log.e("test", "auth fail");
>> }
>>  catch (IOException e) {
>> Log.e("test", "There was a problem communicating with the service.");
>>  }
>> catch (ServiceException e) {
>> Log.e("test", "The server had a problem handling your request.");
>>  }
>> catch (Exception e) {
>> Log.e("test", "Unkwown error");
>>  }
>> }
>> }.start();
>> }
>>
>> The result is #1~#3 I mentioned above.
>> Please help.
>>
>> Thank you.
>>
>>
>> On Tuesday, January 8, 2013 6:11:00 PM UTC-5, Joshua Park wrote:
>>>
>>> Hi Mike,
>>>
>>> I have the same problem: myUserFeed.**getAlbumEntries() returns 0 
>>> entries where myUserFeed.getEntries() returns the correct number of Albums 
>>> but they are GphotoEntry(not **AlbumEntry).
>>> I am using Version 2.0 libraries on Android.
>>>
>>> I added :
>>> gdata-base-1.0.jar
>>> gdata-client-1.0.jar
>>> gdata-client-meta-1.0.jar
>>> gdata-core-1.0.jar
>>> gdata-docs-3.0.jar
>>> gdata-docs-meta-3.0.jar
>>> gdata-media-1.0.jar
>>> gdata-photos-2.0.jar
>>> gdata-photos-meta-2.0.jar
>>> activation.jar
>>> mail.jar
>>> servlet-api.jar
>>> guava-jdk5-13.0.jar
>>>
>>> libraries.
>>>
>>> -------------------
>>> So:
>>>
>>> #1: It doesn't print anything
>>>  for (AlbumEntry entry : myUserFeed.getAlbumEntries()) {
>>> Log.v("test", entry.getGphotoId() + ":" + entry.getTitle().getPlainText(
>>> **) );
>>>  Log.v("test", entry.getGphotoId() + ":" + 
>>> entry.getSummary().**getPlainText() 
>>> );
>>> }
>>>
>>> #2: It prints album info (but they are not AlbumEntry)
>>> for (GphotoEntry entry : myUserFeed.getEntries()) {
>>> Log.v("test", entry.getGphotoId() + ":" + entry.getTitle().getPlainText(
>>> **) );
>>>  Log.v("test", entry.getGphotoId() + ":" + 
>>> entry.getSummary().**getPlainText() 
>>> );
>>> }
>>>  #3: It prints album info (but they are not AlbumEntry)
>>> Query albumQuery = new Query(feedUrl);
>>>  AlbumFeed feed = service.query(albumQuery, AlbumFeed.class);
>>> for (GphotoEntry entry : feed.getEntries()) {
>>> Log.v("test", entry.getGphotoId() + ":" + entry.getTitle().getPlainText(
>>> **) );
>>>  Log.v("test", entry.getGphotoId() + ":" + 
>>> entry.getSummary().**getPlainText() 
>>> );
>>> }
>>>
>>>
>>> On Tuesday, September 18, 2012 5:45:35 PM UTC-4, Mike Erickson wrote:
>>>>
>>>> Okay, I put together a working test file with a new set of client 
>>>> libraries downloaded. I was able to successfully print album titles like 
>>>> this:
>>>>
>>>> URL feedUrl = new URL("https://picasaweb.google.**
>>>> com/data/feed/api/user/**default?kind=album<https://picasaweb.google.com/data/feed/api/user/default?kind=album>
>>>> ");
>>>>     UserFeed userFeed = myService.getFeed(feedUrl, UserFeed.class);
>>>>
>>>>     for (AlbumEntry albumEntry : userFeed.getAlbumEntries()) {
>>>>       System.out.println(albumEntry.**getTitle().getPlainText());
>>>>     }
>>>>
>>>> Ralph, the problem for you might be that you are calling 
>>>> UserFeed.getEntries() instead of UserFeed.getAlbumEntries() which is 
>>>> returning a base class instead of the AlbumEntry class the way you were 
>>>> expecting.
>>>>
>>>> Let me know if you have more trouble here.
>>>>
>>>> Thanks,
>>>> -m.e.
>>>>
>>>> On Tuesday, September 18, 2012 10:26:54 AM UTC-7, Mike Erickson wrote:
>>>>>
>>>>> Hi Ralph,
>>>>>
>>>>> I'm sorry this isn't working for you. I'll try to find a solution, 
>>>>> although nothing immediately comes to mind. If I can duplicate the issue, 
>>>>> then I can help fix it. .
>>>>>
>>>>> Thank you,
>>>>> -Mike
>>>>>
>>>>> On Tuesday, September 18, 2012 4:29:52 AM UTC-7, Ralph wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I also cannot get this working correctly. I have the following JARs 
>>>>>> in my classpath:
>>>>>>
>>>>>> - gdata-base.jar
>>>>>> - gdata-core.jar
>>>>>> - gdata-client.jar
>>>>>> - gdata-client-meta.jar
>>>>>> - gdata-photos.jar
>>>>>> - gdata-photos-meta.jar
>>>>>>
>>>>>> Despite all this, when I call UserFeed.getEntries() I just get a list 
>>>>>> of GphotoEntry objects that are _not_ instances of AlbumEntry. The entry 
>>>>>> titles, however, do correspond to the titles of my albums. I'm using the 
>>>>>> API from a Google App Engine servlet by the way, not a client 
>>>>>> application. It looks like there's been a lot of silence regarding this 
>>>>>> topic and I also noticed that a lot of related questions on this forum 
>>>>>> do 
>>>>>> not get any answers. I hope somebody can reply so we can get this 
>>>>>> working. 
>>>>>> I'm planning on using the Picasa API for a commercial web application so 
>>>>>> it's quite important for me :)
>>>>>>
>>>>>> Greetz,
>>>>>>
>>>>>> Ralph
>>>>>>
>>>>>>
>>>>>> On Monday, August 27, 2012 11:27:02 AM UTC+2, 李龙涛 wrote:
>>>>>>>
>>>>>>> 在 2011年5月15日星期日UTC+8下午9时44分15秒,c**remer...@gmail.com写道: 
>>>>>>> > Thanks! It works! 
>>>>>>>
>>>>>>> I did so, but it still does not work, someone can help me?
>>>>>>
>>>>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google Picasa Web Albums API" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/google-picasa-data-api/-/FE82OnMmAOsJ.
>>
>> To post to this group, send email to 
>> google-pica...@googlegroups.com<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> google-picasa-data-api+unsubscr...@googlegroups.com <javascript:>.
>> For more options, visit this group at 
>> http://groups.google.com/group/google-picasa-data-api?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Picasa Web Albums API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-picasa-data-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-picasa-data-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-picasa-data-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to