Thank you Paul,

Ok I will stop trying to implement it using 1.X
But the problem is all the docs either refer to the older code and
though it is functional from all platforms, it is not so helpful for
android. It will be helpful for us if the docs are updated.

I have posted this in gdata-java-client group and what was suggested
is to use the Account Manager that is available on android platforms
2.0 and higher or to use the OAuth. And they have a pointed to a
picasa example demonstrating this.
http://groups.google.com/group/gdata-java-client/browse_thread/thread/c6a30f19212283cd?hl=en

But the problem again is with Google Health.
I am looking at the picasa example but it seems to be different from
how I can do the authentication to Google Health. It has a
Authentication Token which it can use but I am struck at implementing
the same for Google Health as its not clear how to get the same for
GH. Can you suggest the changes that would be required in that
authentication for authenticating to GH?

Since you said that you have some snippets of code using HTTPClient,
can you share it here so that I can try that approach too. I atleast
want to get through the authentication part which is being a hassle
particularly for GH. I have looked at those docs more than a few times
and will keep reading them and though they are helpful, they are still
lacking in a few areas and there is a very limited support on how we
can implement GH on android.

Will keep it posted here if I am able to make any progress.

Achie.

On Jun 15, 6:27 pm, "Paul (Google)" <[email protected]> wrote:
> Hi Achie,
>
> There seems to be issues with using the version 1.x (version 1.41.3)
> GData Java client libraries on Android.  You should be able to use the
> version 2, alpha GData Java client libraries at the following page:
>
> http://code.google.com/p/gdata-java-client/wiki/Version2
>
> This Java client documentation for Health corresponds to the 1.x
> version of the GData client library, however, so there may be some
> differences between the Health documentation and alpha library.  The
> library development team will certainly be able to help understand the
> differences.  If you need support, they have a discussion group at the
> following location that should be helpful.  We can certainly try to
> debug issues with these libraries in this group as well!
>
> http://groups.google.com/group/gdata-java-client/topics
>
> Alternately, you can connect to Health using the Apache HTTPClient
> that's included with Android, following the protocol instructions at
> the following location:
>
> http://code.google.com/apis/health/docs/2.0/developers_guide_protocol...
>
> I have some snippets of code using the HTTPClient that I'd be happy to
> share; although, it's not a complete example app yet.  If you're stuck
> at a particular point using the HTTPClient, I can definitely see about
> sharing or writing some example code.
>
> Paul
>
> On Jun 15, 10:00 am, Achie <[email protected]> wrote:
>
> > Megha,
>
> > you might be able to use this to get the CCR as XML, which you might
> > have to parse. I do not know if Google already has the libraries or
> > saxparsers which would do this. So I am writing them myself for now.
> > But I could not get the authentication to work from android as I have
> > described in my earlier post. Can you help me with that since you seem
> > to have managed to finish the authentication part.
>
> > Here is the code that can be used to pull the CCR as xml.[Code from
> > Google]
> >                 ProfileFeed feed = service.getFeed(new 
> > URL(PROFILE_FEED_PATH + "ui/"
> > + profileId), ProfileFeed.class);
> >                 for (ProfileEntry entry : feed.getEntries()) {
>
> > out.println(entry.getContinuityOfCareRecord().getXmlBlob().getBlob());
> >                 }
>
> > Thank you,
> > Achie.
>
> > On Jun 15, 10:54 am, Achie <[email protected]> wrote:
>
> > > Hi,
>
> > > I am able to access the CCR records using client login but I could not
> > > do the same from android. I guess I am missing some saxparser
> > > libraries.
> > > Here is the code that I am using. I am using the same code that was
> > > used in the example code provided by google for client login.
> > > Can someone let me know where I am going wrong or what I am missing.
>
> > >                         GoogleService myService = new GoogleService(
> > >                         "health","My Application");
> > >                         myService.setUserCredentials("username", 
> > > "password");
>
> > >                         // Get a list of all entries
> > >                         URL metafeedUrl = new 
> > > URL("https://www.google.com/health/feeds/
> > > profile/list");
> > >                         System.out.println("Getting Health profile 
> > > entries...\n");
> > >                         Feed resultFeed = myService.getFeed(metafeedUrl, 
> > > Feed.class);
> > >                         List<Entry> entries = resultFeed.getEntries();
> > >                         for(int i=0; i<entries.size(); i++) {
> > >                                 Entry entry = entries.get(i);
> > >                                 System.out.println("\t" + 
> > > entry.getTitle().getPlainText());
> > >                                 profilesString += 
> > > entry.getTitle().getPlainText()+ "\n";
> > >                         }
> > > And here are my referenced libraries.
> > > gdata-core-1.0.jar
> > > gdata-client-meta-1.0.jar
> > > gdata-client-1.0.jar
> > > gdata-health-meta-2.0.jar
> > > gdata-health-2.0.jar
> > > gdata-media-1.0.jar
> > > jsr305.jar
> > > google-collect-1.0-rc1.jar
>
> > > And this is the error log that I get.
> > > I/dalvikvm(10388): Could not find method
> > > javax.xml.parsers.SAXParserFactory.getSchema, referenced from method
> > > com.google.gdata.util.common.xml.parsing.SecureGenericXMLFactory
> > > $SecureSAXParserFactory.getSchema
> > > W/dalvikvm(10388): VFY: unable to resolve virtual method 12342: Ljavax/
> > > xml/parsers/SAXParserFactory;.getSchema ()Ljavax/xml/validation/
> > > Schema;
> > > D/dalvikvm(10388): VFY: replacing opcode 0x6e at 0x0002
> > > D/dalvikvm(10388): Making a copy of Lcom/google/gdata/util/common/xml/
> > > parsing/SecureGenericXMLFactory$SecureSAXParserFactory;.getSchema code
> > > (32 bytes)
> > > W/dalvikvm(10388): VFY: unable to find class referenced in signature
> > > (Ljavax/xml/validation/Schema;)
> > > I/dalvikvm(10388): Could not find method
> > > javax.xml.parsers.SAXParserFactory.setSchema, referenced from method
> > > com.google.gdata.util.common.xml.parsing.SecureGenericXMLFactory
> > > $SecureSAXParserFactory.setSchema
> > > W/dalvikvm(10388): VFY: unable to resolve virtual method 12350: Ljavax/
> > > xml/parsers/SAXParserFactory;.setSchema (Ljavax/xml/validation/
> > > Schema;)V
> > > D/dalvikvm(10388): VFY: replacing opcode 0x6e at 0x0002
> > > D/dalvikvm(10388): Making a copy of Lcom/google/gdata/util/common/xml/
> > > parsing/SecureGenericXMLFactory$SecureSAXParserFactory;.setSchema code
> > > (28 bytes)
> > > W/XmlParser(10388): javax.xml.parsers.ParserConfigurationException:
> > > org.xml.sax.SAXNotRecognizedException:http://xml.org/sax/features/external-parameter-entities
> > > W/XmlParser(10388): javax.xml.parsers.ParserConfigurationException:
> > > org.xml.sax.SAXNotRecognizedException:http://xml.org/sax/features/external-parameter-entities
> > > W/XmlParser(10388):     at
> > > org.apache.harmony.xml.parsers.SAXParserFactoryImpl.newSAXParser(SAXParserF
> > >  actoryImpl.java:
> > > 84)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.util.XmlParser.parse(XmlParser.java:682)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.util.XmlParser.parse(XmlParser.java:576)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.data.BaseFeed.parseAtom(BaseFeed.java:867)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java
> > >  :
> > > 68)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java
> > >  :
> > > 39)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.wireformats.input.CharacterParser.parse(CharacterParser.ja
> > >  va:
> > > 100)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.wireformats.input.XmlInputParser.parse(XmlInputParser.java
> > >  :
> > > 52)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java
> > >  :
> > > 66)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java
> > >  :
> > > 34)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.client.Service.parseResponseData(Service.java:2165)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.client.Service.parseResponseData(Service.java:2098)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.client.Service.getFeed(Service.java:1136)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.client.Service.getFeed(Service.java:998)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
> > > W/XmlParser(10388):     at
> > > com.google.gdata.client.Service.getFeed(Service.java:1017)
> > > W/XmlParser(10388):     at
> > > gh.com.achie.test.Health.getProfilesForUI(Health.java:60)
> > > W/XmlParser(10388):     at gh.com.achie.test.Main.onClick(Main.java:33)
> > > W/XmlParser(10388):     at android.view.View.performClick(View.java:2364)
> > > W/XmlParser(10388):     at android.view.View.onTouchEvent(View.java:4179)
> > > W/XmlParser(10388):     at
> > > android.widget.TextView.onTouchEvent(TextView.java:6541)
> > > W/XmlParser(10388):     at android.view.View.dispatchTouchEvent(View.java:
> > > 3709)
> > > W/XmlParser(10388):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
> > > W/XmlParser(10388):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
> > > W/XmlParser(10388):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
> > > W/XmlParser(10388):     at
> > > android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
> > > W/XmlParser(10388):     at com.android.internal.policy.impl.PhoneWindow
> > > $DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
> > > W/XmlParser(10388):     at
> > > com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneW
> > >  indow.java:
> > > 1107)
> > > W/XmlParser(10388):     at
> > > android.app.Activity.dispatchTouchEvent(Activity.java:2061)
> > > W/XmlParser(10388):     at com.android.internal.policy.impl.PhoneWindow
> > > $DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
> > > W/XmlParser(10388):     at
> > > android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
> > > W/XmlParser(10388):     at
> > > android.os.Handler.dispatchMessage(Handler.java:99)
> > > W/XmlParser(10388):     at android.os.Looper.loop(Looper.java:123)
> > > W/XmlParser(10388):     at
> > > android.app.ActivityThread.main(ActivityThread.java:4363)
> > > W/XmlParser(10388):     at java.lang.reflect.Method.invokeNative(Native
> > > Method)
> > > W/XmlParser(10388):     at java.lang.reflect.Method.invoke(Method.java:
> > > 521)
> > > W/XmlParser(10388):     at com.android.internal.os.ZygoteInit
> > > $MethodAndArgsCaller.run(ZygoteInit.java:860)
> > > W/XmlParser(10388):     at
> > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
> > > W/XmlParser(10388):     at dalvik.system.NativeStart.main(Native Method)
> > > W/System.err(10388):
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups 
"Google Health 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/googlehealthdevelopers?hl=en.

Reply via email to