Project documentation - Technion

sunglowmaizeΚινητά – Ασύρματες Τεχνολογίες

10 Δεκ 2013 (πριν από 3 χρόνια και 10 μήνες)

107 εμφανίσεις

Facedroi
d


Facebook for Android







Documentation















Gitit Raz


stoosh@t2.techinon.ac.il

Amit Feller


samitf@t2.technion.ac.il



Ofer Manos



somanos@t2.technion.ac.il



























Facebook User















Facebook Server

plication
p
Facebook A


-

API key

-

Secret key

-

PHP page

PI(implemented by us)
Facebook A


-

Using POST/GET requests

-

Get friends

-

Send
/Receive MSG

-

Update Info

-

Upload pics

-

GPS Services

-

Etc…….

c慣e䑲潩o⁕


-

Login Page

-

Main Page

-

Friends Data

-

User Menu
s

-

Unique Services

-

Application Settings

FaceDroid

Adds
application

Owns

Phone


"Facebook API"

Purpose:

To provide the functionality for fetching i
nformation from a facebook
account. This information will be displayed on the Android phone interface using the
facedroid

UI (described later).

Method:

We encountered a difficulty using the facebook API provided by facebook,
because the Android (Dalvi
k) OS does not support third party applications. We
suggested 2 ways to overcome this difficulty: either by using a proxy server, or by
implementing our own "facebook API", by manually writing the relevant methods we
need. We decided to go for the latte
r.

So we have implemented our own Facebook API, using Http Post
\
Get commands to
the facebook rest server.

The API is implemented in the
facebook

Package, which consists of two Classes:



Command.java



an abstraction layer for the Http Post
\
Get Commands to t
he
reset server, which simplify the construction of the Facbook API functions.



FacebookAPI.java


the implemented API functions.


Example for the
friends.get
function
(
http://wiki.de
velopers.facebook.com/index.php/Friends.get
) implementation using
Command.java

Class


public

String friends_get()

{


Command friends =
new

Command(
mHclient
,
"friends.get"
);


friends.addParam(
"session_key"
,
mSession
);


friends.addParam(
"call_id"
,
mCall_id
.t
oString());


mCall_id

=
mCall_id
+1;


return

friends.execute();

}



All of the available Facebook API functions are described at
http://wiki.developers.facebook.com/index.php/API

Implementin
g new function for the API can be done easily using the
Command.java

Class…




Communicate with



Adds Application



Own Phone














Facebook Side Application

In order to create an application that fetches information from Facebook, it was
necessary to create a Facebook application, on the Facebo
ok side. This application is
called

Android Mobile Phone Application
,
and enabled us to get an application key
and secret, which we use to establish a connection with the Facebook

server.

As part of the Facebook
-
side application, we have created a php website
http://apps.facebook.com/android_app

(hosted at
http://db8602dd.fb.joyent.
us/
,
cour
t
esy of Joyent


free for one year).

This website is to be accessed by any
Facebook user wishing to use our Android application. Once a user enters the site, it
pops up an "allow" dialog, asking the user permission for the application to access

his
details. Once the user allowed this, the user can use the application on his Android
based phone.

Furthermore, we have requested Facebook to publish our application, and have been
approved.



Facedroid

UI

Purpose: To provide a convenient user interf
ace in Android
-
phone, for the
facedroid

user. This means a user will be able to see all the functionality
of facebook that we provide, in such a way that is convenient to look at on a mobile
phone.

Method: Runs on Android Emulator. We use the Android U
I API, designing with
XML, using sources, designing a layout for each activity. The connection between
the different activities depends on the user pressing buttons such as: menu, back and
so on.


Facedroid

All together our implementations on the side of
the Android are done on the Android
Emulator. It includes the UI described, and the part of implementing our own
"facebook API". Finally, this gives the user a convent way to access facebook useful
features.




















Class

Architecture












Packages



























Facebook







Android.facebook.UI




Xml.Parser



Facebook API

Classes


Facedroid
Activities &
Services


Xml Parsing
module & Data
Classes

Classes





-
Command








Overview of the Architecture in the Diagram

As can be seen in the diagram above, the program consists of 3 packages,
divided by functionality.


'Android.facebook.UI'

-

packag
e includes the main
functioning classes,
including
activities (for each page in the application) and services.
This
package uses the other packages
'

classes.
Each activity layout (the way
the page

is visually arranged) is

bound with an equivalent xml lay
out file
(having a similar name), which is located in a folder provided by the
workspace.


'Facebook'
-

package includes the classes containing functions handling
the faceboo
k server requests, this is the

facebook API implementation.



'XML.Parser'

-

pack
age includes a parser for the XML data coming
from the facebook server, and data structures to accommodate this data.


The packages work together using the appropriate functions in order to
draw the UI, fetch information from facebook, parse it and show it
.


The division to these packages allows future development and extension
to the project, in a convenient way, and independently to each aspect.










-
Command

-
FacebookApi

-
Parser

-
AlbumData

-
Pic

-
Event

-
FriendData

-
FriendExtendedData

-
MainUser

-
Notifications

-
EventService

-
OnCallPhoneService

-
AlbumGallery

-
AlbumPhotoesSwitcher

-
facebook

-
F
riendAdapter

-
FriendPage

-
FriendSendMSG

-
FriendsList

-
MainPage

-
PhotoUpload

-
Settings

-
UpdateStatus