Tip:
Highlight text to annotate it
X
Hi. I am Manfred from the bada team of Samsung Mobile. In this video , we in the bada team
will present some of the great new features introduced in bada 2.0.
We’ll explain the important new namespaces and classes, walk you through code, show you
examples running in the Emulator and on a device and introduce you to some of the new
tools to help your development. So, first up, here's Keith to tell you about
the new UIX features. We’re particularly excited about two new
features introduced in the UIX namespace: Text To Speech and Speech To Text.
Text To Speech lets you convert normal text language into speech. Maybe you want to read
a book on your phone, but you’re too tired to read the screen. With Text To Speech you
can have your device read to you. Implementing Text to Speech functionality
is easy. Let’s take a look at an example. The first thing we do is create and then construct
an object of the class TextToSpeech, which is part of the UIX namespace. Then we call
Initialize to set up the service. One thing you need to know is that to use either text
to speech or speech to text, you must have a network connection. If you don’t have
a network connection then initialization will fail.
To get your device to actually speak, you need to implement the ItextToSpeechEventListener
and in the OnTextToSpeechStatusChanged handler, wait for the TTS service to be initialized.
Then everything’s set and you can call the Speak method.
By default text to speech uses US English, but you can use the SetLocale method to change
the type of voice used. Currently TTS supports UK English, German, French, Spanish and Italian.
You’ve also got control over other settings too. You can choose a Female voice with the
SetVoiceType method , and choose the speech rate.
The Speech to Text feature lets you translate spoken words to text. So, you could control
your application using your voice or write a dictation app or even do language translation.
Speech to Text is implemented using the SpeechToText class which is part of the UIX namespace.
First you create an object of the SpeechToText class, then call Construct and finally call
Initialize. Like the Text To Speech feature, Speech to Text requires a network connection
and you need to ensure that the service is initialize before it starts working.
To handle Speech to Text related events you need to implement the ISpeechToTextEventListener.
The OnSpeechToTextInitialized handler is called when the service is initialized and you can
then SpeechToText::Start to recording the speech to process. Once you’re done call
Stop and when the speech service has finished processing you’ll be sent the result in
the OnTextToSpeechCompleted method. Let’s launch one of the new SDK samples
to see that in action. Here’s the STT Note Taker sample running
in the Emulator. We’ll start the recording, speak some words and wait to see the result.
You also have control over a number of settings, so you can choose how to process silence,
grammatical settings and even the profanity filter.
Here's Sameer to tall you about another important new feature- Multi-tasking.
Setting up your app to support multi-tasking is easy. In the IDE go to Project|Properties|Application
Information, scroll to the bottom of the window and click the Multitasking checkbox.
It only makes sense for certain types of tasks to run in the background- such as playing
music, monitoring sensors and updating location information. Any application for which it
only makes sense to run in the foreground shouldn’t need to have multi tasking enabled
since memory management becomes more of an issue with lots of apps running.
To ensure your app works correctly in a multi-tasking environment, you need to write some additional
code. If a bada device is running low on memory and your app is running in the background,
your app may be forced to quit. You’ll need to implement the IAppCheckPointEventListener
to save the application state when your app is terminated, usually in such low memory
situations. In the OnAppCheckPointing handler, you’ll get a chance to write information
out to the registry or other files, so that nothing is lost when your app terminates.
Apps can now exchange messages using inter application communication.
This is implemented by new classes in the Io namespace: ChannelManager, ClientChannel
and ServerChannel, as well as the listener classes for channel related events. You set
up a channel between applications using their app IDs and can send data between a specified
group of apps. We have 2 applications: Client and Server.
In the client application we press the request button, to send a request to the server.
The server application receives the request, logs it and sends the response back to the
client app. The client app receives the response and displays the data in the form.
Now let’s see how we implement this functionality in the code.
On pressing the request button, we send a request to the server using the server’s
appid. The server form is derived from the IChannelRequestEventListener and receives
requests in the OnChannelReceivedRequestN method. On receiving a request from the client
application, we prepare the response and send it back using the SendResponse() method.
The client’s form is derived from the IChannelResponseEventListener. It receives responses from the server in the
OnChannelResponseReceivedN callback method. Now here's my good friend Cheng to tell you
all you about NFC is bada 2.0. Another great new feature in bada 2.0 is support
for NFC, the near field communication technology. First, I want to introduce the basic technical
side of NFC. Then I will focus on what you can do with NFC on bada, show you some code
and a demo. In this demo we’ll show you how to read information from an NFC tag.
The starting point for implementing NFC is the NfCManager class. After you have instantiated
an object of the NfcManager class, you then need to add two listeners: one to enable you
to find the NFC tag and the other to detect NDEF records on the tag.
Once you have prepared your NfcManager object, you can start to check the activation status
of NFC. When we know the status of NFC sensor, we
can then start the operations such as detecting the NFC tags and reading information. Let’s
begin with detecting the tags. Once you’ve added the tag detection listener
to the NFC manager object, the OnNfcTagDetectedN() callback will be called automatically. Let’s
have a look how we could implement the OnNfcTagDetectedN() callback.
What we first did was to check whether the connections supports the NDEF message operation-
which is the most common NFC standard. Then we set the NDEF tag listener to this connection
and start to read from the tag. Once we have got the tag connection from the
OnNfcTagDectedN() callback and set the NdefTagConnectionListener, we can get the NDEF record from the OnNdefReadCompletedN()
callback. Since NFC is designed for short range communication
between NFC devices, the read and write operation happened right after the tag was detected
and without any authentication or pairing process. So if the tag contains NDEF records,
the results will be return on OnNdefReadCompletedN() callback
It is possible that one NFC tag contains multiple NDEF records. You can use GetRecordsCount()
and GetRecordAt() from the NdefMessage class to retrieve all the records.
The write process is almost the same as the read process for the NFC tags.
So here’s the NFC tag which we pre-programmed with a URL as a NDEF record. Then we launch
the sample code called TagReader, read the tag and once the device detects the tag information,
it shows the payload information of the tag- which is our developer.bada.com URL of course.
Then we connect to the URL using the Dolfin Browser.
In Part 1 we introduced you to some of the new features in bada 2.0.
We showed you some of the new text to speech and speech to text classes, the great new
multi-tasking features and of course NFC. Stay tuned for Part 2 where we will look at
the new web development technologies, UI features and some of the new tools.
Thanks for watching.