| Talking Reminder this project is intenfed for people who are not tech savvy

ReadReminderTextService.java
1 package com.sudogeeks.talking_reminder;
2
3 import android.app.Service;
4 import android.content.Intent;
5 import android.os.IBinder;
6 import android.speech.tts.TextToSpeech;
7
8 import java.util.Locale;
9
13 public class ReadReminderTextService extends Service implements TextToSpeech.OnInitListener, TextToSpeech.OnUtteranceCompletedListener {
14 private TextToSpeech mTts;
15 private String spokenText;
16
20 @Override
21
22 public void onCreate() {
23 mTts = new TextToSpeech(this, this);
24 // This is a good place to set spokenText
25 // spokenText="raushan raushan raushan raushan";
26 }
27
35 @Override
36
37 public int onStartCommand(Intent intent, int flags, int startId) {
38 spokenText = intent.getStringExtra("MyTitle");
39 return START_STICKY;
40 }
41
46 @Override
47
48 public void onInit(int status) {
49 if (status == TextToSpeech.SUCCESS) {
50 int result = mTts.setLanguage(Locale.US);
51 if (result != TextToSpeech.LANG_MISSING_DATA && result != TextToSpeech.LANG_NOT_SUPPORTED) {
52
53 mTts.speak(spokenText, TextToSpeech.QUEUE_ADD, null);
54
55 }
56 }
57 }
58
59 @Override
60 public void onUtteranceCompleted(String uttId) {
61 stopSelf();
62 }
63
64 @Override
65 public void onDestroy() {
66 if (mTts != null) {
67 mTts.stop();
68 mTts.shutdown();
69 }
70 super.onDestroy();
71 }
72
73 @Override
74 public IBinder onBind(Intent arg0) {
75 return null;
76 }
77 }
com.sudogeeks.talking_reminder.ReadReminderTextService.onCreate
void onCreate()
Definition: ReadReminderTextService.java:22
com.sudogeeks.talking_reminder.ReadReminderTextService.onInit
void onInit(int status)
Definition: ReadReminderTextService.java:48
com.sudogeeks.talking_reminder.ReadReminderTextService
Class for Text to speech service This class is extending the tts module service to speak up the remin...
Definition: ReadReminderTextService.java:13
com.sudogeeks.talking_reminder.ReadReminderTextService.onStartCommand
int onStartCommand(Intent intent, int flags, int startId)
Definition: ReadReminderTextService.java:37