public class SayMyTextService
extends android.app.Service
implements android.speech.tts.TextToSpeech.OnInitListener
| Modifier and Type | Field and Description |
|---|---|
protected android.media.AudioManager |
audioManager |
protected List<String> |
awaitingTexts
texts to read, received before the textospeech is ready or while a call is in progress
|
protected Map<android.bluetooth.BluetoothDevice,Integer> |
bluetoothDevices
bluetooth devices which are currently connected
|
protected static String |
BT_UTTERANCE_ID
utterance id when the bluetooth device is connected
|
protected android.telephony.PhoneStateListener |
callStateListener
Listener to clal state change
|
protected Boolean |
canSpeak
null if the texttospeech is not initialized
|
static String |
INTENT_EXTRA_ADD_BT_DEVICE
If true, the device has just connected, else disconnected
|
static String |
INTENT_EXTRA_BT_DEVICE
Bluetooth device which has just connected or disconnected
|
static String |
INTENT_EXTRA_SMS_BODY
Body of the SMS
|
static String |
INTENT_EXTRA_SMS_SENDER
Number of the sender of the SMS
|
protected android.speech.tts.TextToSpeech |
textToSpeech |
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITYACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_ROUTER_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, UI_MODE_SERVICE, USB_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE| Constructor and Description |
|---|
SayMyTextService() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
getContactDisplayNameByNumber(String number)
Finds the contact name in the contact book
|
android.os.IBinder |
onBind(android.content.Intent intent) |
void |
onCreate() |
void |
onDestroy() |
void |
onInit(int status) |
int |
onStartCommand(android.content.Intent intent,
int flags,
int startId) |
protected void |
readText(List<String> texts,
boolean btConnected)
Reads the texts out loud
|
protected void |
requestReading(List<String> texts)
Requests the reading of a list of texts through the wired headset or bluetooth device
|
protected void |
requestReading(String text)
Requests the reading of one text through the wired headset or bluetooth device
|
protected void |
requestReadingOverBt(List<String> texts)
Starts the connection with the bluetooth device and requests the reading
|
protected void |
setCanSpeak(Boolean canSpeak)
Sets if the texts can be read
|
dump, getApplication, onConfigurationChanged, onLowMemory, onRebind, onStart, onTaskRemoved, onTrimMemory, onUnbind, startForeground, stopForeground, stopSelf, stopSelf, stopSelfResultattachBaseContext, bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalFilesDir, getFilesDir, getFileStreamPath, getMainLooper, getObbDir, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, sendStickyOrderedBroadcast, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterReceiverpublic static final String INTENT_EXTRA_SMS_BODY
public static final String INTENT_EXTRA_SMS_SENDER
public static final String INTENT_EXTRA_BT_DEVICE
public static final String INTENT_EXTRA_ADD_BT_DEVICE
protected static final String BT_UTTERANCE_ID
protected android.media.AudioManager audioManager
protected Boolean canSpeak
protected android.speech.tts.TextToSpeech textToSpeech
protected List<String> awaitingTexts
protected Map<android.bluetooth.BluetoothDevice,Integer> bluetoothDevices
protected final android.telephony.PhoneStateListener callStateListener
public void onCreate()
onCreate in class android.app.Servicepublic void onDestroy()
onDestroy in class android.app.Servicepublic android.os.IBinder onBind(android.content.Intent intent)
onBind in class android.app.Servicepublic int onStartCommand(android.content.Intent intent,
int flags,
int startId)
onStartCommand in class android.app.Servicepublic void onInit(int status)
onInit in interface android.speech.tts.TextToSpeech.OnInitListenerprotected void setCanSpeak(Boolean canSpeak)
canSpeak - null if the texttospeech is not ready,
false if a call is in progress
true otherwiseprotected void requestReading(String text)
text - the text to readprotected void requestReading(List<String> texts)
texts - the texts to readprotected void requestReadingOverBt(List<String> texts)
texts - the texts to readprotected void readText(List<String> texts, boolean btConnected)
texts - the texts to readbtConnected - if true, adds the utterance id for the bluetooth deviceCopyright © 2014 CodeLutin. All rights reserved.