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(SAXParserFactoryImpl.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.java:
> 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(PhoneWindow.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): com.google.gdata.util.ParseException:
> org.xml.sax.SAXNotRecognizedException:http://xml.org/sax/features/external-parameter-entities
> W/System.err(10388): at
> com.google.gdata.util.XmlParser.parse(XmlParser.java:708)
> W/System.err(10388): at
> com.google.gdata.util.XmlParser.parse(XmlParser.java:576)
> W/System.err(10388): at
> com.google.gdata.data.BaseFeed.parseAtom(BaseFeed.java:867)
> W/System.err(10388): at
> com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:
> 68)
> W/System.err(10388): at
> com.google.gdata.wireformats.input.AtomDataParser.parse(AtomDataParser.java:
> 39)
> W/System.err(10388): at
> com.google.gdata.wireformats.input.CharacterParser.parse(CharacterParser.java:
> 100)
> W/System.err(10388): at
> com.google.gdata.wireformats.input.XmlInputParser.parse(XmlInputParser.java:
> 52)
> W/System.err(10388): at
> com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:
> 66)
> W/System.err(10388): at
> com.google.gdata.wireformats.input.AtomDualParser.parse(AtomDualParser.java:
> 34)
> W/System.err(10388): at
> com.google.gdata.client.Service.parseResponseData(Service.java:2165)
> W/System.err(10388): at
> com.google.gdata.client.Service.parseResponseData(Service.java:2098)
> W/System.err(10388): at
> com.google.gdata.client.Service.getFeed(Service.java:1136)
> W/System.err(10388): at
> com.google.gdata.client.Service.getFeed(Service.java:998)
> W/System.err(10388): at
> com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
> W/System.err(10388): at
> com.google.gdata.client.Service.getFeed(Service.java:1017)
> W/System.err(10388): at
> gh.com.achie.test.Health.getProfilesForUI(Health.java:60)
> W/System.err(10388): at gh.com.achie.test.Main.onClick(Main.java:33)
> W/System.err(10388): at android.view.View.performClick(View.java:
> 2364)
> W/System.err(10388): at android.view.View.onTouchEvent(View.java:
> 4179)
> W/System.err(10388): at
> android.widget.TextView.onTouchEvent(TextView.java:6541)
> W/System.err(10388): at
> android.view.View.dispatchTouchEvent(View.java:3709)
> W/System.err(10388): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
> W/System.err(10388): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
> W/System.err(10388): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
> W/System.err(10388): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
> W/System.err(10388): at com.android.internal.policy.impl.PhoneWindow
> $DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
> W/System.err(10388): at
> com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
> 1107)
> W/System.err(10388): at
> android.app.Activity.dispatchTouchEvent(Activity.java:2061)
> W/System.err(10388): at com.android.internal.policy.impl.PhoneWindow
> $DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
> W/System.err(10388): at
> android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
> W/System.err(10388): at
> android.os.Handler.dispatchMessage(Handler.java:99)
> W/System.err(10388): at android.os.Looper.loop(Looper.java:123)
> W/System.err(10388): at
> android.app.ActivityThread.main(ActivityThread.java:4363)
> W/System.err(10388): at java.lang.reflect.Method.invokeNative(Native
> Method)
> W/System.err(10388): at java.lang.reflect.Method.invoke(Method.java:
> 521)
> W/System.err(10388): at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:860)
> W/System.err(10388): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) ...
>
> 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.