Android Question Audio Lib crash on android 9

Juan Vargas (Bioagro)

Member
Licensed User
I've created a small app to test the audio recorder library, because in my main project the audio recorder library return success = false, and sometimes crashes. It works perfectly on android 8, but the problem happens in android 9.

Below the app to test the audio recorder
B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    Dim audioRecorder As AudioRecordApp
End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        audioRecorder.Initialize("audioRecorder")
    End If
    RecordAudio
End Sub

Sub RecordAudio
    audioRecorder.Record(File.DirRootExternal, "1.3gpp")
End Sub
Sub audioRecorder_RecordComplete (Success As Boolean)
    Log(Success)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


This program returns this error:
in this line (audioRecorder.Record(File.DirRootExternal, "1.3gpp"))

java.lang.RuntimeException: Object should first be initialized (List).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.collections.List.getSize(List.java:129)
at anywheresoftware.b4a.objects.collections.List.getSize(List.java:129)
at anywheresoftware.b4a.objects.collections.List.getSize(List.java:129)
at anywheresoftware.b4a.objects.collections.List.getSize(List.java:129)
.
.
.
.


Why it says that a list should be initialized?
Thanks for help
 

Juan Vargas (Bioagro)

Member
Licensed User
Update:
I Inserted this code in activity create
B4X:
        rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
        Wait For activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_READ_EXTERNAL_STORAGE denied")
            Return
        End If

        rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
        Wait For activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_WRITE_EXTERNAL_STORAGE denied")
            Return
        End If

        rp.CheckAndRequest(rp.PERMISSION_RECORD_AUDIO)
        Wait For activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_RECORD AUDIO denied")
            Return
        End If

Audio recorder opens and begins recording, but won't save the file.
Also, rp.PERMISSION_RECORD_AUDIO is not allowed, I don't know why. It didnt even ask for the permission.
 
Upvote 0

Juan Vargas (Bioagro)

Member
Licensed User
Of course.
This is the complete non filtered log.
Program launch the audio record window, and records fine.
But it return success=false. I have granted dirrootexternal permission.

B4X:
Logger connected to:  samsung SM-J400M
--------- beginning of main
Not starting debugger since process cannot load the jdwp agent.
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
common created.
Starting remote logger. Port: 35352
tagSocket(46) with statsTag=0xffffffff, statsUid=-1
createDecorCaptionView >> DecorView@b3859a8[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
Skia GL Pipeline
[EmergencyManager] android createPackageContext successful
Input channel constructed: fd=54
setView = DecorView@b3859a8[main] TM=true MM=false
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x7 surface={true 3800520704} changed=true
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
Initialized EGL, version 1.4
Swap behavior 2
tagSocket(60) with statsTag=0xffffffff, statsUid=-1
tagSocket(61) with statsTag=0xffffffff, statsUid=-1
*** Debugger waiting for connection (0) ***
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [720x1280]-format:1
eglCreateWindowSurface = 0xe2408220, 0xe2875808
tagSocket(64) with statsTag=0xffffffff, statsUid=-1
After accept
MSG_WINDOW_FOCUS_CHANGED 1 1
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
Starting input: tba=b4a.example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
startInputInner - Id : 0
startInputInner - mService.startInputOrWindowGainedFocus
Input channel constructed: fd=68
tagSocket(65) with statsTag=0xffffffff, statsUid=-1
*** Debugger waiting for connection (1) ***
tagSocket(70) with statsTag=0xffffffff, statsUid=-1
MSG_RESIZED_REPORT: frame=[0,0][720,1280] ci=[0,42][0,0] vi=[0,42][0,0] or=1
Input channel constructed: fd=74
setView = android.widget.LinearLayout{4e4a625 V.E...... ......I. 0,0-0,0} TM=true MM=false
Text: Xait in android.widget.Toast$TN@59833fa
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
Starting input: tba=b4a.example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
startInputInner - Id : 0
*** Service (starter) Create ***
Relayout returned: old=[0,42][720,1280] new=[96,1091][623,1168] result=0x7 surface={true 3448979456} changed=true
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [527x77]-format:1
eglCreateWindowSurface = 0xe2408fa0, 0xcd934008
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Class android.support.v4.content.ContextCompat failed lock verification and will run slower.
** Activity (main) Resume **
MSG_RESIZED: frame=[96,1091][623,1168] ci=[0,0][0,0] vi=[0,0][0,0] or=1
** Activity (main) Pause, UserClosed = false **
MSG_WINDOW_FOCUS_CHANGED 0 1
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
EGLNativeWindowType 0xe2875808 disconnect failed
eglDestroySurface = 0xe2408220, 0xe2875800
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x5 surface={false 0} changed=true
EGLNativeWindowType 0xcd934008 disconnect failed
eglDestroySurface = 0xe2408fa0, 0xcd934000
dispatchDetachedFromWindow
Input channel destroyed: fd=74
Input channel destroyed: fd=68
stopped(true) old=false
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x1 surface={false 0} changed=false
stopped(false) old=true
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x7 surface={true 3800520704} changed=true
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [720x1280]-format:1
eglCreateWindowSurface = 0xe96e1ce0, 0xe2875808
sending message to waiting queue (OnActivityResult)
stopped(false) old=false
running waiting messages (1)
Sucess:false
** Activity (main) Resume **
MSG_WINDOW_FOCUS_CHANGED 1 1
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
Starting input: tba=b4a.example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
startInputInner - Id : 0
startInputInner - mService.startInputOrWindowGainedFocus
Input channel constructed: fd=71
** Activity (main) Pause, UserClosed = false **
stopped(true) old=false
EGLNativeWindowType 0xe2875808 disconnect failed
eglDestroySurface = 0xe96e1ce0, 0xe2875800
dispatchDetachedFromWindow
Input channel destroyed: fd=54
createDecorCaptionView >> DecorView@3446295[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
Input channel constructed: fd=63
setView = DecorView@3446295[main] TM=true MM=false
Relayout returned: old=[0,0][1280,720] new=[0,0][1280,720] result=0x7 surface={true 3473143808} changed=true
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [1280x720]-format:1
eglCreateWindowSurface = 0xe24081c0, 0xcf03f808
sendUserActionEvent() returned.
Background concurrent copying GC freed 3765(298KB) AllocSpace objects, 3(60KB) LOS objects, 49% free, 1782KB/3MB, paused 199us total 164.153ms
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
MSG_WINDOW_FOCUS_CHANGED 1 1
prepareNavigationBarInfo() DecorView@3446295[main]
getNavigationBarColor() -855310
prepareNavigationBarInfo() DecorView@3446295[main]
getNavigationBarColor() -855310
Starting input: tba=b4a.example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
startInputInner - Id : 0
startInputInner - mService.startInputOrWindowGainedFocus
Input channel constructed: fd=73
Input channel destroyed: fd=71
** Activity (main) Pause, UserClosed = false **
MSG_RESIZED_REPORT: frame=[0,0][1280,720] ci=[0,42][0,0] vi=[0,42][0,0] or=2
EGLNativeWindowType 0xcf03f808 disconnect failed
eglDestroySurface = 0xe24081c0, 0xcf03f800
Relayout returned: old=[0,0][1280,720] new=[0,0][1280,720] result=0x5 surface={false 0} changed=true
MSG_WINDOW_FOCUS_CHANGED 0 1
prepareNavigationBarInfo() DecorView@3446295[main]
getNavigationBarColor() -855310
stopped(true) old=false
Input channel destroyed: fd=73
Log reader error: java.io.InterruptedIOException: read interrupted
-1 received
writer error
java.lang.InterruptedException
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2034)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2068)
    at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:387)
    at anywheresoftware.b4a.remotelogger.Connector$Writer.run(Connector.java:160)
    at java.lang.Thread.run(Thread.java:764)
dispatchDetachedFromWindow
System.exit called, status: 0
VM exiting with result code 0, cleanup skipped.
Not starting debugger since process cannot load the jdwp agent.
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
common created.
Starting remote logger. Port: 35352
tagSocket(46) with statsTag=0xffffffff, statsUid=-1
createDecorCaptionView >> DecorView@b3859a8[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
Skia GL Pipeline
[EmergencyManager] android createPackageContext successful
Input channel constructed: fd=54
setView = DecorView@b3859a8[main] TM=true MM=false
Service started in the background. Trying to start again in foreground mode.
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x1 surface={false 0} changed=false
stopped(true) old=false
tagSocket(56) with statsTag=0xffffffff, statsUid=-1
tagSocket(57) with statsTag=0xffffffff, statsUid=-1
*** Debugger waiting for connection (0) ***
Input channel constructed: fd=59
setView = android.widget.LinearLayout{4e4a625 V.E...... ......I. 0,0-0,0} TM=true MM=false
Text: Xait in android.widget.Toast$TN@59833fa
Relayout returned: old=[0,42][720,1280] new=[96,1091][623,1168] result=0x7 surface={true 3800520704} changed=true
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
Initialized EGL, version 1.4
Swap behavior 2
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [527x77]-format:1
eglCreateWindowSurface = 0xe2408100, 0xe2875808
MSG_RESIZED_REPORT: frame=[96,1091][623,1168] ci=[0,0][0,0] vi=[0,0][0,0] or=1
tagSocket(67) with statsTag=0xffffffff, statsUid=-1
*** Debugger waiting for connection (1) ***
tagSocket(68) with statsTag=0xffffffff, statsUid=-1
tagSocket(72) with statsTag=0xffffffff, statsUid=-1
*** Service (starter) Create ***
After accept
** Service (starter) Start **
Key b4a_foreground expected Integer but value was a java.lang.Boolean.  The default value 0 was returned.
Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Integer
    at android.os.BaseBundle.getInt(BaseBundle.java:1036)
    at android.content.Intent.getIntExtra(Intent.java:8049)
    at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent(ServiceHelper.java:152)
    at b4a.example.starter.handleStart(starter.java:99)
    at b4a.example.starter.access$000(starter.java:8)
    at b4a.example.starter$1.run(starter.java:71)
    at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand(ServiceHelper.java:235)
    at b4a.example.starter.onStartCommand(starter.java:69)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3892)
    at android.app.ActivityThread.access$1700(ActivityThread.java:237)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7073)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
** Activity (main) Create, isFirst = true **
Class android.support.v4.content.ContextCompat failed lock verification and will run slower.
** Activity (main) Resume **
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x1 surface={false 0} changed=false
sending message to waiting queue (OnActivityResult)
stopped(false) old=true
stopped(false) old=false
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x1 surface={false 0} changed=false
Surface is not valid.
** Activity (main) Pause, UserClosed = false **
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x1 surface={false 0} changed=false
stopped(true) old=false
EGLNativeWindowType 0xe2875808 disconnect failed
eglDestroySurface = 0xe2408100, 0xe2875800
dispatchDetachedFromWindow
Input channel destroyed: fd=59
Log reader error: java.io.InterruptedIOException: read interrupted
-1 received
writer error
java.lang.InterruptedException
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2034)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2068)
    at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:387)
    at anywheresoftware.b4a.remotelogger.Connector$Writer.run(Connector.java:160)
    at java.lang.Thread.run(Thread.java:764)
dispatchDetachedFromWindow
Input channel destroyed: fd=54
** Service (starter) Destroy (ignored)**
System.exit called, status: 0
VM exiting with result code 0, cleanup skipped.
Not starting debugger since process cannot load the jdwp agent.
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
common created.
Starting remote logger. Port: 35352
tagSocket(46) with statsTag=0xffffffff, statsUid=-1
createDecorCaptionView >> DecorView@b3859a8[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
Skia GL Pipeline
tagSocket(48) with statsTag=0xffffffff, statsUid=-1
After accept
[EmergencyManager] android createPackageContext successful
Input channel constructed: fd=56
setView = DecorView@b3859a8[main] TM=true MM=false
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x7 surface={true 3800520704} changed=true
tagSocket(63) with statsTag=0xffffffff, statsUid=-1
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
tagSocket(64) with statsTag=0xffffffff, statsUid=-1
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
Initialized EGL, version 1.4
*** Debugger waiting for connection (0) ***
Swap behavior 2
MSG_WINDOW_FOCUS_CHANGED 1 1
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [720x1280]-format:1
eglCreateWindowSurface = 0xe2408e20, 0xe2875808
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
Starting input: tba=b4a.example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
startInputInner - Id : 0
startInputInner - mService.startInputOrWindowGainedFocus
Input channel constructed: fd=69
Input channel constructed: fd=70
setView = android.widget.LinearLayout{4e4a625 V.E...... ......I. 0,0-0,0} TM=true MM=false
Text: Xait in android.widget.Toast$TN@59833fa
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
Starting input: tba=b4a.example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
startInputInner - Id : 0
MSG_RESIZED: frame=[0,0][720,1280] ci=[0,42][0,0] vi=[0,42][0,0] or=1
Relayout returned: old=[0,42][720,1280] new=[96,1091][623,1168] result=0x7 surface={true 3455508480} changed=true
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [527x77]-format:1
eglCreateWindowSurface = 0xe2406a20, 0xcdf6e008
MSG_RESIZED_REPORT: frame=[96,1091][623,1168] ci=[0,0][0,0] vi=[0,0][0,0] or=1
tagSocket(73) with statsTag=0xffffffff, statsUid=-1
*** Debugger waiting for connection (1) ***
tagSocket(74) with statsTag=0xffffffff, statsUid=-1
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Class android.support.v4.content.ContextCompat failed lock verification and will run slower.
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
MSG_WINDOW_FOCUS_CHANGED 0 1
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
EGLNativeWindowType 0xe2875808 disconnect failed
eglDestroySurface = 0xe2408e20, 0xe2875800
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x5 surface={false 0} changed=true
EGLNativeWindowType 0xcdf6e008 disconnect failed
eglDestroySurface = 0xe2406a20, 0xcdf6e000
dispatchDetachedFromWindow
Input channel destroyed: fd=70
Input channel destroyed: fd=69
stopped(true) old=false
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x1 surface={false 0} changed=false
sending message to waiting queue (OnActivityResult)
stopped(false) old=true
stopped(false) old=false
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x7 surface={true 3800520704} changed=true
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [720x1280]-format:1
eglCreateWindowSurface = 0xe96e1ce0, 0xe2875808
running waiting messages (1)
Sucess:false
** Activity (main) Resume **
MSG_WINDOW_FOCUS_CHANGED 1 1
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
Starting input: tba=b4a.example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
startInputInner - Id : 0
startInputInner - mService.startInputOrWindowGainedFocus
Input channel constructed: fd=69
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
Starting input: tba=b4a.example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
startInputInner - Id : 0
startInputInner - mService.startInputOrWindowGainedFocus
Input channel constructed: fd=70
Input channel destroyed: fd=69
** Activity (main) Pause, UserClosed = false **
stopped(true) old=false
EGLNativeWindowType 0xe2875808 disconnect failed
eglDestroySurface = 0xe96e1ce0, 0xe2875800
Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x5 surface={false 0} changed=false
MSG_WINDOW_FOCUS_CHANGED 0 1
prepareNavigationBarInfo() DecorView@b3859a8[main]
getNavigationBarColor() -855310
 
Upvote 0

Juan Vargas (Bioagro)

Member
Licensed User
I have tried it on android 6, 8. It works. Not in android 9.
Android 9 in Samsung J4.
The audio recorder program in phone works fine. But when called from the app, it always returns sucess=false.
Again, the same program works perfectly in others version of android.
 
Upvote 0

Juan Vargas (Bioagro)

Member
Licensed User
Ok, I'll show you the complete listing.
The audio complete sub returns success= false in Android 9, but works in others versions.

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    Dim audioRecorder As AudioRecordApp
    Dim rp As RuntimePermissions

End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        audioRecorder.Initialize("audioRecorder")
        rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
        Wait For activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_READ_EXTERNAL_STORAGE denied")
            Return
        End If

        rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
        Wait For activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_WRITE_EXTERNAL_STORAGE denied")
            Return
        End If

        rp.CheckAndRequest(rp.PERMISSION_RECORD_AUDIO)
        Wait For activity_PermissionResult(permission As String, Result As Boolean)
        If Result = False Then
            Log("PERMISSION_RECORD AUDIO denied")
            Return
        End If

        
    End If
    RecordAudio
End Sub

Sub RecordAudio
    audioRecorder.Record(File.DirRootExternal, "1.3gpp")
End Sub
Sub audioRecorder_RecordComplete (Success As Boolean)
    Log("Sucess:" & Success)
End Sub


Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Here. Its a small project. The sub audioRecorder_RecordComplete, returns false after the audio recording finished, seems like it has problems saving the audio file, but I can't find how solve it.
 
Upvote 0
Top