Pedometer’s Update

I have continued working on the Pedometer.  I realized that Text-to-Speech was not feasible in the current state.  Every-time the service would leak.  The obvious solution everywhere says to shutdown the Text-to-Speech engine.  So I was already shutting down, checking that it was running, and no matter which way the service would leak.  In the end I had to change constructors and remove this feature.  Text-to-speech is really cool.  I have thoughts of another way it can work.  But for now the Pedometer works OK.  Otherwise, I re-implemented an idea I had at first, that I was using from an early version of the Native Android Pedometer. Instead of making new objects, I removed listeners when stopping the Pedometer timer, then added back the corresponding listener when enabling the timer.  This is better to me, because there are less objects being created doing the same thing.  Maybe the Garbage Collector would have taken care of this.  So this Pedometer has gone places this year.  From where I started with the Cordova PhoneGap Accelerometer JavaScript, with sliders to adjust sensitivity to a PhoneGap Application that implements Native Android Background Services and Native Accelerometer that runs in the background even when the user turns of the display.  I have tested this implementation on two nights.  I count approximately 6000 steps plus calories!

Advertisements

MyOscar – Data

Dylan Segna

After getting requests and authentication working with MyOscar, it is time to start looking into how to push medical data into a user’s account.
The way this is done is by passing a MedicalDataTransfer object that looks like this:

<xs:complexType final="extension restriction" name="medicalDataTransfer4">
    <xs:sequence>
        <xs:element name="active" type="xs:boolean"/>
        <xs:element name="annotationCount" type="xs:long"/>
        <xs:element name="completed" type="xs:boolean"/>
        <xs:element minOccurs="0" name="data" type="xs:string"/>
        <xs:element minOccurs="0" name="dateOfData" type="xs:dateTime"/>
        <xs:element minOccurs="0" name="editDate" type="xs:dateTime"/>
        <xs:element minOccurs="0" name="editorPersonId" type="xs:long"/>
        <xs:element minOccurs="0" name="id" type="xs:long"/>
        <xs:element minOccurs="0" name="medicalDataType" type="xs:string"/>
        <xs:element minOccurs="0" name="observationLocation" type="xs:string"/>
        <xs:element minOccurs="0" name="observerOfDataPersonId" type="xs:long"/>
        <xs:element minOccurs="0" name="observerOfDataPersonName" type="xs:string"/>
        <xs:element minOccurs="0" name="originalSourceId" type="xs:string"/>
        <xs:element minOccurs="0" name="owningPersonId" type="xs:long"/>
    </xs:sequence>
</xs:complexType>

The most important field to look at is the data field. This is where the actual medical data is being transferred. Before I could start transferring medical data of my own, I needed to figure out how this data is supposed to be formatted for sending.

I inputted some test data…

View original post 178 more words

HTML5 Support in Android and IOS?

 

 

 

  1. Introduction
  2. Why Do We Care?
  3. Android KitKat (4.4) – Latest version of android
  4. Fennec (Firefox for android)
  5. Android NDK
  6. Conclusion

 

 

 

 

 Introduction

 

Android is an open source mobile platform and has more then half of the market share for smart phones. Developing on android requires knowledge of Java but it is not a steep learning curve. Web developers may be interested in its new support for WebView based off of source code used in Chrome. There is a slight difference between android webviews and chrome browser and I will explain these details in the following blog post.

 

Android KitKat (4.4) – Latest version of android

 

Android KitKat is the latest version of the Android platform as of this writing (Dec. 5, 2013).  The main feature that will interest developers is the new chrome like WebView. Android Applications use webviews based on Chromium Code which includes common Javascript V8 and Blink rendering found in version 30 of Google Chrome on Android version 4.4.

 

Pro’s vs. Con’s

 

Cons:

Not the same as chrome because it doesn’t support:

        1) WebRTC

        2) WebGL 3D Canvas

        3) WebAudio

        4) Fullscreen API

        5) Form Validation

        6) Chrome Apps Platform

 

 

   

Pro:

Supports HTML5 better JavaScript run time, lets you do remote debugging using chrome developer tools.

Why do we care?

Support for HTML5 helps make using the web richer and will make developing apps easier. If WebRTC is fully supported then perhaps you could video chat with someone using our browser or android phone instead of downloading and installing third party files.

 

Fennec (Firefox on Android)

screenshot from https://play.google.com/store/apps/details?id=org.mozilla.firefox

 

 

I’m investigating if it is possible to ship a browser in an android application. In my search I came across Fennec which is the Firefox implementation of Android. Firefox is written in C++ and Fennec uses the same source code but also adds another layer of native Android code. Fennec is designed for smart phones, touch screen devices and UI utilizes a different XUL then what is found in Firefox for PC. Since it’s used on smart phones then they are limited in CPU, memory, etc. Fennec uses parallel processing to run on android.

 

 

Like most technology Fennec has dependencies and the dependencies are:

 

  1. Must download NDK for Android     
  2. Set the mozconfig environment variables for Fennec.
  3. Must download mozilla-central git repository (https://github.com/mozilla/mozilla-central)

   

How does NDK for android work?

 

Prerequisite: 

Must understand JNI to work with the NDK source code.

 

In a nutshell, NDK lets you create shared libraries that basically lets you embed a C/C++ application in your Android App. Works on Android 1.5 Platform or later however I think Fennec can only run on 1.6 and greater. Although its better practice to develop applications in native code, you can write an application in C++ and have a wrapper.

 

 

Can Firefox Run on IOS?

On Mozilla’s website it says that Fennec doesn’t run on IOS but after speaking with a developer at Mozilla I found out that someone has created a way to build Firefox on IOS.

 

Source code is located here:

http://hg.mozilla.org/users/tanya.meshkova_gmail.com/ios-patches/

 

Here is a screen shot of how it looks:

link to original page: https://imgur.com/r8Qti

 

 

 

Conclusion:

 

Perhaps by using Android NDK which is used by Firefox to embed C/C++ source files in your Android application, we could perhaps embed Firefox in an applications. Or even

better perhaps we could totally replace the need of using WebViews and use a XUL window to display the page you would like to view.

 

 

 

 

 

MyOscar Web Services – Authenticating a Request

Dylan Segna

At the end of this post :
http://dylansegna.wordpress.com/2013/12/04/myoscar-web-services-sending-a-request/
We had a response that looked like :

login4Response{
	return=anyType{
		person=anyType{
			active=true; 
			editDate=2013-10-11T12:36:43Z; 
			editorId=2; 
			id=##;                                  //number id of the user
			lastLogin=2013-12-02T21:26:38Z; 
			role=PATIENT; 
			sponsoringOrganisationId=0; 
			userName= myusername;                  //user's username
		}; 
		securityTokenKey= ?????????????;               //a security key of random characters generated by the server
	}; 
}

Now we are going to use this login response to authenticate a soap request that accesses the user’s protected information.

private void login(String username, String pw) {
	String METHOD = "login4";
	SoapObject request = new SoapObject(NAMESPACE,METHOD);
	request.addProperty("arg0",username);
	request.addProperty("arg1",pw);

	SoapObject response = soap.sendSoapRequest(request, METHOD, LoginWsUrl);
	securityToken = SoapHelper.getString(response, "return/securityTokenKey");
	userId = SoapHelper.getString(response, "return/person/id");
	soap.provideAuthentication(userId, securityToken);
}

There are some new things in this function now, so let’s go over them.
After sending the soap request and receiving a response, the two SoapHelper.getString() functions are called to fill the securityToken and userId variables. I created this function to access nested values in…

View original post 357 more words

MyOscar Web Services – Sending a Request

Dylan Segna

I have finally gotten MyOscar web services access working, so I plan to outline how I did this in my next two posts. This first post will focus on how to send a soap request to a myOscar server.

It should be noted that I am using the ksoap2 library for creating and sending soap requests.

Here is how I went about sending a login request to a myOscar server:

static final String NAMESPACE = "http://ws.myoscar_server.oscarehr.org/";
static final String LoginWsUrl = "http://demo.oscarmcmaster.org:11245/myoscar_server/ws/LoginService";
public void login(String username, String pw) {                             
	String METHOD = "login4";                                               
	SoapObject request = new SoapObject(NAMESPACE,METHOD);                  
	request.addProperty("arg0",username);                                   
	request.addProperty("arg1",pw);                                         

	SoapObject response = soap.sendSoapRequest(request, METHOD, LoginWsUrl);
	response = (SoapObject) response.getProperty("return");                    
}

There is alot going on here, so let’s go over this one step at a time.
Where do the NAMESPACE and LoginWsUrl variables come from?
These values come from the web services definitions provided by the developer of the…

View original post 269 more words