This is the presentation used in the bada Orange partner day. BuddyFix is an open source project developed by Samsung Electronics Research Institute in UK. The project home page is here (http://bit.ly/BuddyFix/). You can follow us @buddyfix to get the lates information.
1. Building LBS App on bada
@chengluo
bada Orange Partner day - 05 May
2. Agenda
• Services available from bada
• Introduction of BuddyFix project
• Quick start with BuddyFix
• Get your hands dirty...
3. Services on bada
• Currently 4 types of server side services available on bada
- Social Services
- Location Services
- Content Services
- Commerce Services
• More services will be available on bada 2.0 SDK incl. Ad Services, Push
notification, Lifelogging...
• Samsung provides the server infrastructure and free to use
• Seamless integration with 3rd party solutions, e.g. Facebook, Twitter, MySpace,
deCarta map etc.
4. The bada Server
• Handling bada services in unified APIs
• Hiding the details of specific
integrations
• Authenticate bada apps with 3rd
party servers
• Forwarding calls to 3rd party servers
• No need to worry about load
balancing, backup solution or
downtime
5. Social Services
• BuddyService: manages buddy relationship
• ProfileService: searches and updates different types of user
profile
• SNSGateway: provides easy integration for Twitter, Facebook
and MySpace
• MessagingService: provides free messaging services via the
bada server
6. Location Services
• MapService: displays and operate the map
• GeocodingService: translates coordinates to readable address
and vice versa
• RouteService: finds the route between two coordinates
• DirectoryService: provides POI information for given
geographic area - e.g. check-in
7. Content Services
• ContentInfo/RemoteContentInfo: the metadata of physical content on the
device or bada server
• ContentManager/RemoteContentManager: create, update or delete the
content on the device or bada server
• ContentSearch/RemoteContentSearch: find the right content on the device
or bada server
• RemoteContentSharing: sharing content with friends and set the access
level of content
• There are more classes from this namespace...
8. Commerce Services
• ItemInfo: informationof item incl. name, price, download URI,
description, image, ID and other information
• ItemService: create and get items from the Samsung store
• PurchaseInfo: providesthe information of purchased item, such
as name, price, currency, purchased date and image URI etc.
• PurchaseService: purchase items from the store and get the
purchase information
11. BuddyFix
• Location based social networking application
• Internally developed by Samsung UK team
12. BuddyFix
• Location based social networking application
• Internally developed by Samsung UK team
• Utilised
social, location, profile, privacy, messaging, and content
services on bada
15. BuddyFix 2.0
• Location based social networking application
• Internally developed by Samsung UK team
• Utilised
social, location, profile, privacy, messaging, and content
services on bada
16. BuddyFix 2.0
• Location based social networking application
• Internally developed by Samsung UK team
• Utilised
social, location, profile, privacy, messaging, and content
services on bada
• Integrated simple Facebook and SMS/MMS location sharing
17. BuddyFix 2.0
• Location based social networking application
• Internally developed by Samsung UK team
• Utilised
social, location, profile, privacy, messaging, and content
services on bada
• Integrated simple Facebook and SMS/MMS location sharing
• Source code available on Sourceforge under Apache License 2
24. Goal of Designing BuddyFix
• Easy to use - number of clicks/operation
• Fast to run - using less memory, WYSIWYG
• Long battery life - update data only when it needed
• Easy to implement - central event dispatcher (e.g. FormManager
class + singleton)
• Better UX - offline data/persistent database
• More to be found out by you ...
26. Faster to run
void
FormManager::ChangeForm(Form* pNewForm)
{
__pFrame->AddControl(*pNewForm);
__pFrame->SetCurrentForm(*pNewForm);
pNewForm->Draw();
pNewForm->Show();
if (__pPreviousForm != null)
__pFrame->RemoveControl(*__pPreviousForm);
__pPreviousForm = pNewForm;
}
void FormManager::OnUserEventReceivedN(RequestId formId, Osp::Base::Collection::IList* pArgs)
{
result r = E_SUCCESS;
switch(formId)
{
case QUIT_APP:
if(__pApp != null)
{
r = __pApp->Terminate();
if(IsFailed(r))
AppLogDebug("Terminating application failed! %s", GetErrorMessage(r));
}
else
{
AppLogDebug("Cannot find application pointer!");
}
break;
case MAP_VIEW_FORM:
// TODO JAHS - consider whether MapViewForm should be created once or many times (performance issue)
__pMapViewForm = new MapViewForm();
__pMapViewForm->Construct(__pLocationManager);
ChangeForm(__pMapViewForm);
break;
case SETTING_FORM:
__pSettingForm = new SettingForm();
__pSettingForm->Construct(__pLocationManager, __pMessagingManager, __pProfileManager);
ChangeForm(__pSettingForm);
break;
...
}
27. Longer battery life
//
// API's for power optimisation purpose
// Currently, We optimized the location request and DB update timer.
// If you know few other timers which is not needed when application
// goes to background or screen off, then those can be added here.
void
FormManager::ActivateTimers()
{
AppLogDebug("Activate all Timers for power optimisation");
__pLocationManager->ActivateLocRequestTimer();
AppData::GetInstance()->ActivateDBUpdateTimer();
}
void
FormManager::DeactivateTimers()
{
AppLogDebug("Deactivate all Timers for power optimisation");
__pLocationManager->DeactivateLocRequestTimer();
AppData::GetInstance()->DeactivateDBUpdateTimer();
}
void
BuddyFix::OnForeground(void)
{
AppLogDebug("BuddyFix::OnForeground");
__pFormMrg->ActivateTimers();
}
void
BuddyFix::OnBackground(void)
{
AppLogDebug("BuddyFix::OnBackground");
__pFormMrg->DeactivateTimers();
}
28. Easy to implement
AppData*
AppData::GetInstance(void)
{
if(!__instanceFlag)
{
__pInstance = new AppData();
__pInstance->Construct();
__instanceFlag = true;
}
return __pInstance;
}
void FormManager::OnUserEventReceivedN(RequestId formId, Osp::Base::Collection::IList* pArgs)
{
result r = E_SUCCESS;
switch(formId)
{
...
case SEND_MESSAGE_FORM:
__pSendMessageForm = new SendMessageForm();
__pSendMessageForm->Construct(__pMessagingManager);
ChangeForm(__pSendMessageForm);
break;
case ADD_RECIPIENT_FORM:
__pAddRecipientForm = new AddRecipientForm();
__pAddRecipientForm->Construct(L"IDF_AddRecipientForm");
ChangeForm(__pAddRecipientForm);
break;
case RECEIVED_MESSAGE_FORM:
__pReceivedMessageForm = new ReceivedMessageForm();
__pReceivedMessageForm->Construct(__pMessagingManager);
ChangeForm(__pReceivedMessageForm);
break;
case USER_PROFILE_FORM:
__pUserProfileForm = new UserProfileForm();
__pUserProfileForm->Construct(__pProfileManager);
ChangeForm(__pUserProfileForm);
break;
}
...
}
29. Better UX
//setting exposure level after signIn, otherwise API is failing
AppRegistry* pAppRegistry = Application::GetInstance()->GetAppRegistry();
int value = -1;
result r = pAppRegistry->Get(Osp::Base::Integer::ToString(SettingForm::PROFILE_EXPOSURE_LEVEL), value);
if (!IsFailed(r))
__pProfileManager->SetUserInfoPrivacyLevel((ProfileExposureLevel)value);//set Basic Profile exposure level
result
AppData::LoadApplicationDataFromDatabase(void)
{
result r = __pDatabaseManager->OpenDatabase();
if (IsFailed(r))
{
AppLogDebug("Failed to open the database, result %s", GetErrorMessage(r));
__pDatabaseManager->CloseDatabase();
return r;
}
r = __pDatabaseManager->ReadAll();
if (IsFailed(r))
AppLogDebug("Failed to read data from the database, result %s", GetErrorMessage(r));
return r;
}
buddyTable
+------------+---------------+----------------+------------+-//
| userId | buddyName | longitude | latitude |
+------------+---------------+----------------+------------+-//
| dz7yp3ifya | BuddyName | -1.79675333333 | 51.498485 |
+------------+---------------+----------------+------------+-//
messageTable
+------------+---------------------+------------------+------------+
| senderId | receivedAt | messageText | convId |
+------------+---------------------+------------------+------------+
| b9ayhvtso3 | 11/28/2010 11:57:33 | Hello world | -853525128 |
+------------+---------------------+------------------+------------+