Categories

Archives

Integrating Native Android with .NET via Publish/Subscribe API

A few days ago we published an example demonstrating .NET data push to a native iPhone application. In that example the backend service was a .NET application hosted in WebORB for .NET. The application used WebORB as an RTMP server to deliver real-time updates to the client devices. In addition to the RTMP clients (like an iOS devices or cialis without prescription Flex apps), a slightly modified version of the same code can easily support clients connecting via publish/subscribe API. An example of a such client can be a native Android application using our client-side library. We put together a native Android application and extended the server-side code to support publish/subscribe clients. The video below demonstrates the example in action and provides a brief code review. The instructions for setting up and running the example follow the video.

Follow the steps below to deploy and run the example:

  1. Download and install the latest version of WebORB for .NET. (This post assumes the product is installed in the default installation directory. For the version 4.4, the installation directory is: c:/Program Files/WebORB for .NET/4.4.0.0/)
  2. Download the client-side project from:
    http://examples.themidnightcoders.com/blog/StockExchangeAndroidClient.zip
  3. Download the server-side project from:
    http://examples.themidnightcoders.com/blog/StockExchangeWithPubSub-server.zip
  4. Open the server-side project in Visual Studio. Compile the project and make sure the compiled assembly is copied into the /bin folder in the WebORB installation directory (c:/Program Files/WebORB for .NET/4.4.0.0/bin)
  5. Open messaging-config.xml from c:/Program Files/WebORB for .NET/4.4.0.0/WEB-INF/flex in a text editor.
  6. Add the following XML block before the closing </service> tag:
    <br />
      &lt;destination id=&quot;StockExchangeDestination&quot;&gt;<br />
        &lt;properties&gt;<br />
          &lt;server&gt;<br />
            &lt;durable&gt;false&lt;/durable&gt;<br />
          &lt;/server&gt;<br />
          &lt;message-service-handler&gt;Weborb.Messaging.PubSub.Memory.MessagingServiceHandler&lt;/message-service-handler&gt;<br />
          &lt;message-storage-policy&gt;Weborb.Messaging.PubSub.Memory.MemoryStoragePolicy&lt;/message-storage-policy&gt;<br />
        &lt;/properties&gt;<br />
        &lt;channels&gt;<br />
          &lt;channel ref=&quot;my-polling-amf&quot; /&gt;<br />
        &lt;/channels&gt;<br />
      &lt;/destination&gt;<br />
    
  7. Create “StockExchange” directory under the “Applications” folder located at: c:/Program Files/WebORB for .NET/4.4.0.0/Applications)
  8. Create the app.config file in the StockExchange directory with the following contents:
    <br />
    &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
    &lt;configuration&gt;<br />
    &lt;application-handler&gt;StockExchange.AppHandler&lt;/application-handler&gt;<br />
    &lt;/configuration&gt;<br />
    
  9. Compile and run the Android project. Once the client application runs enter the WebORB remoting endpoint URL (for example for the local installation it may be http://localhost/weborb4/weborb.aspx). Click the ‘Connect’ button to establish a connection with the server-side application.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free