P2P communication Using the GTalk Service API. Introduction Peer-to-Peer communication highly used in mobile devices. Very efficient to when certain factors.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

DISTRIBUTED COMPUTING PARADIGMS
Android Application Development Tutorial. Topics Lecture 6 Overview Programming Tutorial 3: Sending/Receiving SMS Messages.
Services. Application component No user interface Two main uses Performing background processing Supporting remote method execution.
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
Cosc 5/4730 Android Services. What is a service? From android developer web pages: Most confusion about the Service class actually revolves around what.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Remote Method Invocation
The YinYang System. Manager Register/Deregister other Managers Register/Deregister Domains Register/Deregister Active Agents Handle an Agent Service.
A Context Aware Framework Mark Assad Supervisor: Bob Kummerfeld.
P2P (Peer To Peer) Used: when applications need to communicate between devices. Examples: – Interactive game of checkers – Instant Messaging P2P can be.
BroadcastReceiver.  Base class for components that receive and react to events  Events are represented as Intent objects  Intents received as parameter.
Rheeve: A Plug-n-Play Peer- to-Peer Computing Platform Wang-kee Poon and Jiannong Cao Department of Computing, The Hong Kong Polytechnic University ICDCSW.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 42 Web Services.
CS533 - Concepts of Operating Systems 1 Remote Procedure Calls - Alan West.
Android 101 Application Fundamentals January 29, 2010.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Cosc 5/4730 Android SMS. A note first Depending on the API level, an import changes because of a deprecated API 3 uses – import android.telephony.gsm.SmsManager;
Mobile Programming Pertemuan 6 Presented by Mulyono Poltek NSC Surabaya.
J2EE Kenneth M. Anderson CSCI Web Technologies October 3, 2001.
SMS. Short Message Service – Primarily text messages between mobile phones – First one sent December 3, 1982 “Merry Christmas” – In 2008 Approximately.
C++ fundamentals.
Training Content Using the BETaaS platform to: From Laptop From Mobile Phone Access sensors data Create a network of BETaaS gateways Run applications.
박 종 혁 컴퓨터 보안 및 운영체제 연구실 MobiSys '11 Proceedings of the 9th international conference on Mobile systems, applications,
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Concurrency in Android with.
Software Architecture of Android Yaodong Bi, Ph.D. Department of Computing Sciences University of Scranton.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over.
Mobile Computing Lecture#08 IntentFilters & BroadcastReceivers.
Using Intents to Broadcast Events Intents Can be used to broadcast messages anonymously Between components via the sendBroadcast method As a result Broadcast.
COMP 365 Android Development.  Perform operations in the background  Services do not have a user interface (UI)  Can run without appearing on screen.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
Chapter 14 Part II: Architectural Adaptation BY: AARON MCKAY.
DISTRIBUTED COMPUTING PARADIGMS. Paradigm? A MODEL 2for notes
COMP 365 Android Development.  Every android application has a manifest file called AndroidManifest.xml  Found in the Project folder  Contains critical.
ANDROID L. Grewe Components  Java Standard Development Kit (JDK) (download) (latest version)  AndroidStudio.
Introduction to Socket Programming in Android Jules White Bradley Dept. of Electrical and Computer Engineering Virginia Tech
Collaborate Lesson 4C / Slide 1 of 22 Collaborate Knowledge Byte In this section, you will learn about: The EJB timer service Message linking in EJB 2.1.
CS 158A1 1.4 Implementing Network Software Phenomenal success of the Internet: – Computer # connected doubled every year since 1981, now approaching 200.
CSE 341, S. Tanimoto Java brief review - 1 Java Brief Review Java’s strengths Object-oriented terminology Inheritance Interfaces An example with inheritance.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
Jini Architecture Introduction System Overview An Example.
EGOS LLC CCSDS 14/ Question Question; Why a Service Viewpoint? Short Answer; Because a service viewpoint provides a useful additional level.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android.
Capability Model & B2B – Draft for Discussion IBM Research – Haifa Moti Nisenson.
EJB Enterprise Java Beans JAVA Enterprise Edition
The process of establishing a connection between a client and a server is called as Client – Server communication.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
David Sutton SMS TELEPHONY IN ANDROID. OUTLINE  This week’s exercise, an SMS Pub Quiz  Simulating telephony on an emulator  Broadcast Intents and broadcast.
Possible Solution of Interworking between oneM2M and OSGi
Broadcast receivers.
Remote Method Invocation
Android Mobile Application Development
Java Messaging Service (JMS)
Java Messaging Service (JMS)
Java Messaging Service (JMS)
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
Android Topics Asynchronous Callsbacks
Constructors, GUI’s(Using Swing) and ActionListner
Android Developer Fundamentals V2 Lesson 5
Service Services.
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
CIS 470 Mobile App Development
Mobile Programming Broadcast Receivers.
Presentation transcript:

P2P communication Using the GTalk Service API

Introduction Peer-to-Peer communication highly used in mobile devices. Very efficient to when certain factors such as battery, mobility and any other external costs are considered. Short Message Service (SMS)? –Ideal for two very remote devices (satellite?) –Slow –Expensive –Might not carry enough data into one SMS (even more expensive)

GTalkServiceBasics GTalkService Basics Very similar to the Java Listener and Handler technique Mainly consists of: –Several Intents used to send/receive data initialize the service connection –A class implementing the ServiceConnection interface Used once the connection is established –A class extending the IntentReceiver abstract class Used when the message is received –An IGTalkService Used to extract a GTalk session (IGTalkSession) –An IGtalkSession Used to send the data using sendMessage(String, Intent)

ServiceConnection-implementing class Must be implemented to specify what to do during certain connection events Two methods –onServiceConnected(ComponentName, IBinder) Invoked by the Android platform once the requested service connection is established –onServiceDisconnected(ComponentName) Invoked by the Android platform once the connection is lost (legally/illegally)

ServiceConnection continued … onServiceConnected(ComponentName name, IBinder service) 1.IGTalkService gtalk_service = IGTalkService.Stub.asInterface(service); 2.IGTalkSession session = gtalk_service.getDefaultSession(); onServiceDisconnected(ComponentName name) 1.Session = null; //no point in keeping a non-connected session instance

Main procedure Initialize two instances (more on these later on): –A ServiceConnection, and –An IntentReceiver Request a GTalk Service by binding it to your Activity –Create a new Intent –Set the Intent’s component to GTalkService.GTALK_SERVICE_COMPONENT –Bind the intent using bindService(Intent, ServiceConnection, int); Register the IntentReceiver using registerReceiver(IntentReceiver, IntentFilter) The platform will automatically invoke the onServiceConnected(ContextName, IBinder) method

Sending a message… Using the recently extracted session, use the sendMessage(String, Intent); –Intent msg = new Intent(); –msg.setAction(GTalkDataMessageReceiver.ACTION);//to be explained on the next slide –msg.putExtra(“1”, “Line 1”); –msg.putExtra(“2”, 34); –session.sendDataMessage(“john.doe”, msg);

IntentReceiver – abstract class Must implement one particular abstract method: onReceiveIntent(Context, Intent) –Invoked by the Android platform once an intent is received from some external entity –Passes the Intent which was sent by the sender –Must make sure the incoming Intent is a GTalk message sent by the sender

IntentReceiver continued … onReceiveIntent(Context context, Intent intent) 1.if (intent.getAction().equals(GTalkDataM essageReceiver.ACTION)) {//point 2} 2.Bundle b = intent.getExtras(); 3.b.getString(“1”); //returns “Line 1” 4.b.getInt(“2”); //returns 32