0% found this document useful (0 votes)
9 views

Using Wakelocks

Uploaded by

vani
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Using Wakelocks

Uploaded by

vani
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Unit – V

Using Wakelocks
Types of wakelocks:
FULL_WAKE_LOCK — Keeps the screen at full brightness, the keyboard backlight
illuminated, and the CPU running.
SCREEN_BRIGHT_WAKE_LOCK — Keeps the screen at full brightness and the CPU running.
SCREEN_DIM_WAKE_LOCK — Keeps the screen on (but lets it dim) and the CPU running.
PARTIAL_WAKE_LOCK — Keeps the CPU running.
1. Create a wakelocks
2. Acquire the wakelocks
Using Wakelocks
Introducing Android Text to Speech
• The text-to-speech (TTS) libraries, also known as speech synthesis, enable you
to output synthesized speech from within your applications, allowing them to
“talk” to your users.
• Due to storage space constraints on some Android devices, the language
packs are not always preinstalled on each device.
• To check for the TTS libraries, start a new Activity for a result using the
ACTION_CHECK_TTS_DATA action from the TextToSpeech.Engine class.
Introducing Android Text to Speech
• Mobile device should recognize the voice- The onActivityResult handler will
receives CHECK_VOICE_DATA_PASS .
• If the voice data is not currently available, start a new Activity using the
ACTION_INSTALL_TTS_DATA action from the TTS Engine class to initiate its
installation.

• After confirming the voice data is available, need to


1. create and
2. initialize a new TextToSpeech instance.
Pass an OnInitListener into the constructor that will be fired when the TTS
engine has been initialized.
Introducing Android Text to
Speech
Introducing Android Text to
Speech
• After initializing Text To Speech, can use the speak method to synthesize
voice data using the default device audio output:

• The speak method enables you to specify a parameter either


1. to add the new voice output to the existing queue or
2. to flush the queue and start speaking immediately.
• setPitch and setSpeechRate methods. Each method accepts a float
parameter that modifies the pitch and speed, respectively, of the voice
output.
Introducing Android Text to Speech
• setLanguage method – change the pronunciation of your voice output
language.
• This method takes a Locale parameter to specify the country and language of
the text to speak.
• When you have finished speaking, use
1. stop to halt voice output and
2. shutdown to free the TTS resources:
tts.stop();
tts.shutdown();
Introducing Android Text to
Speech
Introducing Android Text to
Speech
AIDL TO SUPPORT INTER-
PROCESS COMMUNICATION

FOR SERVICES
Android Interface Definition Language (AIDL) to supports rich inter-process
communication (IPC) between Services and other application components,
including components running within different applications or within
separate processes.
• To pass objects between processes, underlying OS can then marshal across
application boundaries.
• AIDL is used to simplify the code that lets your processes exchange objects.
• It’s similar to interfaces like COM or Corba in that it lets you create public
methods within your Services that can accept and return object parameters
and return values between processes.
Implementing an AIDL Interface

• AIDL supports the following data types:


1.Java language primitives (int, boolean, float, char, etc.).
2. String and CharSequence values.
3. List objects (including generics), where each element is a supported type. The
receiving class will always receive the List object instantiated as an ArrayList.
4. Map objects (not including generics), where every key and element is of a
supported type. The receiving class will always receive the Map object
instantiated as a HashMap.
5.AIDL-generated interfaces. An import statement is always needed for these.
6. Classes that implement the Parcelable interface An import statement is
always needed for these.
Making Classes Parcelable

You might also like