making your apps more sociable

70
Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved. Making your apps more sociable

Upload: samsung

Post on 24-May-2015

609 views

Category:

Documents


1 download

DESCRIPTION

Making Your Apps More Sociable

TRANSCRIPT

Page 1: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Making your apps more sociable

Page 2: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Contents

Map & Locations features– Map control– Location provider– Remote landmark store

Social features– Buddy– SNS gateway

2

*This material is based on bada SDK 1.0.0b3

Page 3: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Map in bada

3

Page 4: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Think of this …

4

Page 5: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

To do this, you need to …

Display a map– Map control

Get my current location– Location provider

Store information which has a location– Database– Landmark store (Device & Remote )

5

Page 6: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Location application essentials

You must set the privilege group:

Features Header Library Priv. group Priv. level

Map Control

FLocations.h

FlocationControls LOCATION_SERVICE NORMAL

Location ProviderFLocations

LOCATION NORMALRemote Landmark Store REMOTE_LANDMARK SYSTEM

6

Page 7: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Map in bada1. Map control

2. Location provider

3. Remote landmark store

7

Page 8: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Getting a deCarta keyGO!http://developer.decarta.com

8

Page 9: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Using the map control (1/4)

Step 1: Set the map key for deCarta:String extraInfo = L"ClientName=( );ClientPassword=( );HostUrl=http://ws.decarta.com/openls/openls";

9

Page 10: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Using the map control (2/4)

Step 1: Set the map key for deCarta:

Step 2: Create a map provider:

String extraInfo = L"ClientName=( );ClientPassword=( );HostUrl=http://ws.decarta.com/openls/openls";

IMapServiceProvider* __pMapProvider;

__pMapProvider = static_cast<IMapServiceProvider*>(ProviderManager::ConnectToServiceProviderN(L"deCarta",LOC_SVC_PROVIDER_TYPE_MAP, extraInfo));

10

Page 11: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Using the map control (3/4)

Step 1: Set the map key for deCarta

Step 2: Create a map provider

Step 3: Construct the map control:__pMap = new Map();__pMap->Construct(Rectangle(/*size*/), *__pMapProvider);

11

Page 12: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Using the map control (4/4)

Step 1: Set the map key for deCarta

Step 2: Create a map provider

Step 3: Construct the map control:

Step 4: Set the map control :

__pMap = new Map();__pMap->Construct(Rectangle(/*size*/), *__pMapProvider);

__pMap->SetCenter(/* latitude, longitude */, false);__pMap->SetPanEnabled(true);

12

Page 13: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

When maps are not displayed

Check that the name and password are valid

Check the proxy if you are

in a proxy environment

13

Page 14: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Setting proxies

Run the simulator:

Menu > Settings > Connectivity > Network > Connection > bada

14

Page 15: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Location in bada1. Map control

2. Location provider

3. Remote Landmark Store

15

Page 16: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Getting the position from the GPS

Step 1: Add a location update listener:__pLocProvider = new LocationProvider();__pLocProvider->Construct(LOC_METHOD_GPS);__pLocProvider->RequestLocationUpdates

(/*ILocationListener &*/, 5, false);

16

Page 17: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Getting the position from the GPS

Step 1: Add a location update listener:

Step 2: Get the position in the listener:

__pLocProvider = new LocationProvider();__pLocProvider->Construct(LOC_METHOD_GPS);__pLocProvider->RequestLocationUpdates

(/*ILocationListener &*/, 5, false);

void MyClass::OnLocationUpdated(Location &loc){

const QualifiedCoordinates* pCoord = loc.GetQualifiedCoordinates();

if (null != pCoord)__pMap->SetCenter(*pCoord, true);

}

17

Page 18: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Location in bada1. Map control

2. Location provider

3. Remote landmark store

18

Page 19: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Landmarks

A landmark is a location that has a name

In bada, Landmark consists of:Data structures

Name

Description

Coordinates

19

Page 20: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Landmark stores

A landmark store is a persistent database for landmarks

Landmarks can be stored on the device or on the bada Server

Remote landmark stores can be shared among bada users

20

Page 21: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Accessing bada Server

You need a bada account to store landmarks on bada Server

Samsung bada provides an easier way for sign up and sign in:– AppControl

21

Page 22: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

AppControl

AppControl is used to start an application and control specific behavior in it

APPCONTROL_CALENDAR APPCONTROL_DIAL APPCONTROL_MEDIA

22

Page 23: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Signing in the bada Server

AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_SIGNIN, OPERATION_SIGNIN);

if(null != pAc) {pAc->Start(null, this);delete pAc;

}

23

Page 24: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Adding landmarks to a LandmarkStore

Step 1: Create a landmark:Landmark* pLandmark = new Landmark();pLandmark->SetQualifiedCoordinates(/* QualfiedCoor */);pLandmark->SetName(/*name*/);pLandmark->SetDescription(/*description*/);

24

Page 25: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Adding landmarks to a LandmarkStore

Step 1: Create a landmark:

Step 2: Add a landmark to a RemoteLandmarkStore:

Landmark* pLandmark = new Landmark();pLandmark->SetQualifiedCoordinates(/* QualfiedCoor */);pLandmark->SetName(/*name*/);pLandmark->SetDescription(/*description*/);

__pServerStore = new RemoteLandmarkStore(/*STORE NAME*/, /*IRemoteLandmarkStoreListener&*/);

__pServerStore->AddLandmark(*pLandmark, /*category*/, reqId);

25

Page 26: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Searching for landmarks (1/2)

Step 1: Request a search:void MyApp::OnMapDrawCompleted(const Map& source){

RectangleGeographicArea area= source.GetViewport();LandmarkFilter filter;filter.SetGeographicAreaFilter(&area);

}

26

Page 27: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Searching for landmarks (1/2)

Step 1: Request a search:void MyApp::OnMapDrawCompleted(const Map& source){

RectangleGeographicArea area= source.GetViewport();LandmarkFilter filter;filter.SetGeographicAreaFilter(&area);

LandmarkPropertySelector selector;selector.SetQualifiedCoordinatesSelector(true);selector.SetDescriptionSelector(true);

}

27

Page 28: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Searching for landmarks (1/2)

Step 1: Request a search:void MyApp::OnMapDrawCompleted(const Map& source){

RectangleGeographicArea area= source.GetViewport();LandmarkFilter filter;filter.SetGeographicAreaFilter(&area);

LandmarkPropertySelector selector;selector.SetQualifiedCoordinatesSelector(true);selector.SetDescriptionSelector(true);

RequestId reqId;__pServerStore->SearchLandmarks

(&filter, &selector, null, SORT_ORDER_ASCENDING, SORT_BY_NAME, reqId);

}

28

Page 29: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Searching for landmarks (2/2)

Step 1: Request a search

Step 2: Get results:void MyApp::OnLandmarksReceivedN(…, IList* pResults, …){

// implement this handler}

29

Page 30: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Landmark Manager Demo:

30

Demo sequence:– Display a map– Search the nearby landmark– Display the landmark information

Page 31: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

More features for locationsModule Major Uses

Remote locationprovider

Send a location to bada ServerGet other people’s (last known) position

Trace service Get other people’s trajectories

Map service Get a map

Directory service Search through landmarks from a service provider

Geocoding service Perform geocoding and reverse-geocoding

Route service Get a routing information from starting point to end point

31

Page 32: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

When Location meets social features …

32

Page 33: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Using buddy features

Request, respond to, and delete buddies

Manage groups and friendship levels within your buddies

Share your location, contents, or profile with buddies

33

Page 34: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Social in bada1. Searching profile

2. Becoming buddies

3. Sharing locations

34

Page 35: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Searching profile

bada Server

1. Set profile exposure level2. Search Mike’s profile

3.Send buddy request

4. Respond tobuddy request

35

Page 36: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Mike: Set profile exposure level

Step 1: Create a PrivacyManager:__privacyManager = new PrivacyManager();__privacyManager->Construct

(IPrivacyManagerListener&);

I want to share my location

36

Page 37: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Mike: Set profile exposure level

Step 1: Create a PrivacyManager:

Step 2: Set the ProfileExposureLevel:

__privacyManager = new PrivacyManager();__privacyManager->Construct

(IPrivacyManagerListener&);

__privacyManager->SetProfileExposureLevel(PROFILE_SEARCHABLE, reqId);

Set my profile searchable

37

Page 38: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Mike: Set profile exposure level

Step 1: Create a PrivacyManager:

Step 2: Set the ProfileExposureLevel:

Step 3: Confirm the result:

__privacyManager = new PrivacyManager();__privacyManager->Construct

(IPrivacyManagerListener&);

__privacyManager->SetProfileExposureLevel(PROFILE_SEARCHABLE, reqId);

Is the set request

successful?

void OnProfileExposureLevelUpdated(){…}

You must sign-in with bada account before using PrivacyManager!38

Page 39: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Jane: Search profile

Step 1: Construct a ProfileService:__pProfileService = new ProfileService();__pProfileService->Construct

(IProfileServiceListener&);

I want to find some friends

on bada

39

Page 40: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Jane: Search profile

Step 1: Construct a ProfileService:

Step 2: Search profiles:

– Search by Email, LoginId, Name, PhoneNumber

__pProfileService = new ProfileService();__pProfileService->Construct

(IProfileServiceListener&);

__pProfileService->SearchProfilesByName(L”Mike”, …);

Let me try Mike

40

Page 41: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Jane: Search profile

Step 1: Construct a ProfileService:

Step 2: Search profiles:

– Search by Email, LoginId, Name, PhoneNumber

Step 3: Receive profiles:

__pProfileService = new ProfileService();__pProfileService->Construct

(IProfileServiceListener&);

__pProfileService->SearchProfilesByName(L”Mike”, …);

void OnProfileSearchResultsReceivedN(…, Osp::Base::Collection::IList* pBasicProfileList,…)

{…}

Can I check the results?

41

Page 42: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Social1. Searching profile

2. Becoming buddies

3. Sharing locations

42

Page 43: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Becoming buddies

bada Server

1. Set profile exposure level2. Search Mike’s profile

3. Send abuddy request 4. Respond to buddy request

43

Page 44: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Jane: Send a buddy request

Step 1: Create a BuddyService:__pBuddyService = new BuddyService();__pBuddyService->Construct

(IBuddyServiceListener &);

How can I send the

request to Mike

44

Page 45: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Jane: Send a buddy request

Step 1: Create a BuddyService:

Step 2: Send a buddy request:

__pBuddyService = new BuddyService();__pBuddyService->Construct

(IBuddyServiceListener &);

__pBuddyService->RequestBuddy(/* Mikes’s UserID */, reqId);

Send the request

45

Page 46: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Jane: Send a buddy request

Step 1: Create a BuddyService:

Step 2: Send a buddy request:

Step 3: Confirm results:

__pBuddyService = new BuddyService();__pBuddyService->Construct

(IBuddyServiceListener &);

__pBuddyService->RequestBuddy(/* Mikes’s UserID */, reqId);

And I can confirm the

results

void OnBuddyRequestSent(…){…}

46

Page 47: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Mike: Respond to a buddy request

Step 1: Get buddy requests: __pBuddyService->GetReceivedBuddyRequests(reqId);

Is there any buddy

request I received?

47

Page 48: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Mike: Respond to a buddy request

Step 1: Get buddy requests:

Step 2: Receive buddy requests:

__pBuddyService->GetReceivedBuddyRequests(reqId);

void OnReceivedBuddyRequestsReceivedN(…,IList*pRequestList ,…)

{…}

Get the request from the server

48

Page 49: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Mike: Respond to a buddy request

Step 1: Get buddy requests:

Step 2: Receive buddy requests:

Step 3: Respond to buddy requests:

__pBuddyService->GetReceivedBuddyRequests(reqId);

void OnReceivedBuddyRequestsReceivedN(…,IList*pRequestList ,…)

{…}

__pBuddyService->RespondToBuddyRequest(*pRequest, RESPONSE_ACCEPT , reqId);

Got Jane’s, Ok accept!

49

Page 50: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Social 1. Searching profile

2. Becoming buddies

3. Sharing locations

50

Page 51: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Sharing locations

bada Server

1. Share Mike’s location

2. Search Mike’s location

51

Page 52: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Mike: Share a location

Step 1: Set access control list for location:__privacyManager->SetUserInfoPrivacy

(INFO_LOCATION , ACCESS_BUDDY , reqId);

Can I share my location

to my friends?

52

Page 53: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Mike: Share a location

Step 1: Set access control list for location:

Step 2: Get Mike’s location:

__privacyManager->SetUserInfoPrivacy(INFO_LOCATION , ACCESS_BUDDY , reqId);

__pLocationProvider->RequestLocationUpdates(…);

Get my current location

53

Page 54: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Mike: Share a location

Step 1: Set access control list for location:

Step 2: Get Mike’s location:

Step 3: Register Mike’s location to bada Server:

__privacyManager->SetUserInfoPrivacy(INFO_LOCATION , ACCESS_BUDDY , reqId);

__pLocationProvider->RequestLocationUpdates(…);

RemoteLocationProvider::StartLocationReport(…);

Send my location to the server

54

Page 55: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

MyPlace Demo:

55

Demo sequence:– Display a map– Get my friends location– Display them on the map

Page 56: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

The SNS Gateway

56

Page 57: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

SNS gateway

The SNS gateway has unified APIs for different SNS providers

Check the SNS provider’s features and properties before using the SNS gateway:

* MySpace will be supported in SDK b2

Property Description Twitter Facebook

First Name The person’s given name.

Last Name The person’s family name.

Display Name The person’s display name.

User Name The person’s user name.

57

Page 58: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

SNS gateway

badaServer

1. Sharing my position

3. Set my status4. Get friend status

2. Show my and Jane’s locations

Mike Jane

SNS Server Alice

58

Page 59: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Authentication

Step 1: Create SNS gateway __pSnsGateway = new SnsGateway();__pSnsGateway->Construct

(ISnsGatewayListener&, ISnsContentListener *,ISnsPeopleListener *, ISnsActivityListener *);

59

Page 60: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Authentication

Step 1: Create SNS gateway

Step 2: Login to SNS account using SNS gateway API

__pSnsGateway = new SnsGateway();__pSnsGateway->Construct

(ISnsGatewayListener&, ISnsContentListener *, ISnsPeopleListener *, ISnsActivityListener *);

__pAuthenticator = new SnsAuthenticator();__pAuthenticator->Construct(ISnsAuthenticatorListener & );__pAuthenticator->Authenticate

(L"twitter", /*Key*/, /*Secret*/);…__pSnsGateway->AddAuthResult(authResult);

60

Page 61: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Updating and getting status

Update user status:__pSnsGateway->UpdateMyStatusText

(L”twitter”, L”Let’s meet at Starbucks”, reqId);

61

Page 62: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Updating and getting status

Update user status:

Get friend’s status :

__pSnsGateway->UpdateMyStatusText(L”twitter”, L”Let’s meet at Starbucks”, reqId);

__pSnsGateway->GetStatusText(L"twitter", L”Mike”, reqId);

…void OnSnsStatusTextReceived

(..., SnsStatusText *pStatusText, ...)

62

Page 63: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

SimpleTwitter Demo:

63

Demo sequence:– Sing-in with the bada account– Authenticate with the Twitter server– Update tweets

Page 64: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Manage personal data on the device and server

Share and interact with other users

More social features

Device Features

23

Server-assisted Features

•AddressBook

•CalendarBook

•Lifelog

•Buddy •Profile •Board

•Messaging •SNS Gateway

IM

64

Page 65: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Social application essentials

Features Header Library Priv. Group Priv. LevelPrivacyManager

FSocial.h FSocialServices

PRIVACY_SERVICE SYSTEMProfileService PROFILE_SERVICE SYSTEMBuddyService BUDDY_SERVICE SYSTEMSnsGateway SNS_SERVICE SYSTEM

65

Page 66: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Summary

66

Page 67: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

What we have learned

Locations:– How to use the Map control– How to get a location– How to use a remote landmark store– How to get other people’s locations

Social:– How to get buddy– How to use the SNS Gateway

67

Page 68: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Find out more: Locations

Tutorial:– bada Tutorial.Location.pdf

Samples:– LandmarkManager– LocationManager– MapControl– MapViewer– Navigator

68

Page 69: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.

Find out more: Social

Tutorial:– bada Tutorial.Social.pdf

Samples:– BuddyManager– PrivacyManager– SimpleTwitter– TwitterOAuth

69

Page 70: Making Your Apps More Sociable

Copyright© 2010 Samsung Electronics, Co., Ltd. All rights reserved.Dive into