Closed hendrawd closed 7 years ago
@hendrawd After looking at #18, seems like today is not a good day to try this SDK 😛.
The problem seems to be related to the permissions, do you have
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
?
@germanattanasio as i mentioned in the first post, i clone it from example project and run it. The example project itself has
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
as in
https://github.com/watson-developer-cloud/android-sdk/blob/master/example/src/main/AndroidManifest.xml#L7
Sorry @hendrawd, I'm not that familiar with the example project.
For the next update, i think we can support runtime permission for record audio, so we can target newer android sdk
Just to let you know, we are going to move this repo to be part of the java-sdk
next week
@germanattanasio
Just to let you know, we are going to move this repo to be part of the java-sdk next week
Was this repo moved? I'm not sure what that means or how that fixes the problem in this issue. I still get this problem.
@troyibm you can implement runtime permission by yourself to record audio or change targetSdkVersion to 22
i am also facing same issue with below: android { compileSdkVersion 25 buildToolsVersion "25.0.3" defaultConfig { minSdkVersion 21 targetSdkVersion 25}
with below dependency: compile 'com.ibm.watson.developer_cloud:android-sdk:0.2.3' compile 'com.ibm.watson.developer_cloud:java-sdk:3.8.0'
but when i changed targetSdkVersion to 22 it did solved the issue.
@lpatino10 can you look into this too?
Actually it's the problem with runtime permission. Please use SDK version 22 if you don't support runtime permission on the example project yet
Hi @hendrawd I am doing below in my android code:
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode){
case REQUEST_RECORD_AUDIO_PERMISSION:
permissionToRecordAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
break;
case RECORD_REQUEST_CODE: {
if (grantResults.length == 0
|| grantResults[0] !=
PackageManager.PERMISSION_GRANTED) {
Log.i(TAG, "Permission has been denied by user");
} else {
Log.i(TAG, "Permission has been granted by user");
}
return;
}
case CameraHelper.REQUEST_PERMISSION:
permissionOfCamera = grantResults[0] == PackageManager.PERMISSION_GRANTED;
break;
case CameraHelper.REQUEST_IMAGE_CAPTURE:
permissionOfCamera = grantResults[0] == PackageManager.PERMISSION_GRANTED;
break;
}
if (!permissionToRecordAccepted || !permissionOfCamera) finish();
}
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(FullscreenActivity.this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CAMERA_PERMISSION);
return;
}
``
I am actually trying to support runtime permission. Am I doing anything wrong here ??
@hendrawd what exactly is the issue when running your code? When does it crash and what is the error message?
@lpatino10 actually as you can see, i included my stack trace at the first comment. It crash when i tried to get the voice input, maybe when click the record button. @arprasto i don't know, you should follow the runtime permission from google documentation I haven't tried the example project again after my last update and i can't check it right now, so sorry if i can't help. I will check again if i have time.
Hey thanks for the patience. I just made a pull request that I think should fix this issue. Be sure to follow the example code when using the microphone and feel free to open another issue if it's in fact not resolved.
[speech-to-text]
from example project will throwSteps to reproduce
Just use the example project, provide username and password, run
Expected behavior
Not force closed and can accept voice input
Actual behavior
Force closed and throw exception
Android Phone
One Plus One(A001)
CyanogenMod version 14.1-20161123-NIGHTLY-bacon
Android version 7.1
android-sdk version
Same with example project:
compileSdkVersion 23
buildToolsVersion "23.0.2"
minSdkVersion 9
targetSdkVersion 23