With my basic knowledge on Android, I'm trying to play with the Google voice APIs and followed the example here and to write an app, which would allow me to call a hardcoded number. Unfortunately i'm getting an error saying < identifier > expected, so i'm unable to check if my app even works. Can someone see what is missing here and also if i'm even going in the right direction with my thinking and code.
Java file:
public class MyVoiceActivity extends Activity {
class Confirm extends VoiceInteractor.ConfirmationRequest {
public Confirm(String ttsPrompt, String visualPrompt) {
VoiceInteractor.Prompt prompt = new VoiceInteractor.Prompt(
new String[] {ttsPrompt}, visualPrompt);
super(prompt, null);
}
@Override public void onConfirmationResult(boolean confirmed, Bundle null) {
if (confirmed) {
call();
}
finish();
}
};
@Override public void onResume() {
if (isVoiceInteractionRoot()) {
call();
}
Intent intent = new Intent(this, MyVoiceActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
private void call () {
try {
final Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:12345678"));
startActivity(callIntent);
} catch (ActivityNotFoundException activityException) {
}
}
}
AndroidManifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ccvoice.bt.examplevoice">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MyVoiceActivity" >
<intent-filter>
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.VOICE" />
</intent-filter>
</activity>
</application>
</manifest>
The < identifier > required error i'm getting is in this line of the code:
public void onConfirmationResult(boolean confirmed, Bundle null) {
Thank you in advance.