NOTE:

NOTE: Of late, I have been getting requests for very trivial problems that many of you are facing in your day-to-day work. This blog is not to solve your "project" problems - surely not a "Support" site.
I just love to share my knowledge in my spare time and would appreciate any questions or feedback on the articles and code I have shared. I also do appreciate thought-provoking questions that would lead me to write more articles and share.
But please do not put your day-to-day trivial problems here. Even if you do, you most probably would not get a response here.
Thanks

Search This Blog

x

Monday 26 August 2013

Setting up the Samsung Chord SDK

Continuing from the previous posts, I would like to write about setting up the development environment for using the Chord Android SDK and give an overview of the main classes to be used for your first program (to come in a later article).

This is towards aiding android developers in writing apps for the Samsung Android Contest.

  1. Download the Samsung Chord SDK available here
  2. Download the Samsung Chord SDK emulator also available here (need to accept the license agreement in order to download both)
  3. Add the Eclipse plugin for Chord SDK as described in "Chord SDK Emulator Guide ver1.2".
  4.    You can download sample apps from the chord sdk link and run it on the emulator.
  5. The screen shot shows the basic interface of the sample demo. Of course, this can meaning fully execute only after you start the Chord Relay server in the eclipse environment which shows the console and how the UDP broadcast is happening from the emulator. This allows you to do basic stuff like Starting Chord, Joining and leaving a channel.


While the above shows the basics in terms of getting up the first Samsung chord SDK app to work, we need to understand what the Android SDK gives us and what are the classes we have to use to create our own app.

What are the basic classes and interfaces provided by the Chord Android SDK? All of the fundamental ones are described here:

ChordManager – This forms the core of the SDK. This is used to create a Node and helps in managing which nodes are connected to which channels. If you want to know more about channels and nodes, please refer the previous article.

This is the class that hides all the network complexity from the developer. These are the basic features provided by this class:
  1. Tells you the list of available network interfaces like wi-fi or Mobile Access Point etc.
  2.  It gives you an option to start and stop chord
  3.  It gives you an option to leave or join a channel
  4.  Helps you list all the channels the node has joined
  5. And also provides a way to hook up a network listener to respond to changes in the network status.


Most of the main service or game or whatever your application is aiming to achieve through node interactions should be through using the Chord Manager. However, your app – the game or service will also have to provide implementation for 3 listeners:

  1. INetworkListenerChordManager has to listen on this listener to understand the changes in the network state – whether connected or disconnected to the network (of choice – wifi, wifi direct etc.)
  2.  IChordChannelListener – It is through this listener you will have to implement all actions that need to happen when a node joins the network or leaves a network.  Through this you also need to implement what happens when a file/data is received or sent.
  3. IChordManagerListener – is a listener that needs to be implemented when you start your ChordManager. This is required to handle the changes when a ChordManager starts. Also, after starting, the ChordManager, if there is an error or a network disconnect, what should the ChordManager do – is defined in the implementation of this listener.

The above 4 classes/listeners help in implementing your own service that can be used with all your nodes in the network.

However, while you have the entire above service ready, you need to decide which channels are you interested in interacting with?  It could be the public channel or a private channel with a specific name or even many at a time.

The specific channel implementations are those classes that a developer needs to develop by implementing the IChordChannel Interface.

The interface provides the methods for sending and receiving data.

So, in summary, you have the crux of what you really want to do in your own implementation of the IChordChannel.

However, the ChordManager helps you manage connecting and communicating with various nodes in the private or public channels by using 3 listeners.

It is as simple as that. Hope this clarifies the Samsung Chord SDK a bit in order for you to be able to take part in the Samsung Smart App Challenge.




2 comments:

  1. I am also curious to learn implementing my own service. It will be an exciting moment for me to handle services during android apps development and give customize solutions.

    ReplyDelete
  2. Nice post thanks for sharing keep the good work

    Pakistan Prize Bond

    ReplyDelete