Closed ultrasamad closed 5 years ago
Hey @ultrasamad ,
I think that this is an issue with the storage permission which has to be requested in realtime on newer Android versions. This can be done by checking if the permission has already been accepted in our MainActivity.kt file. If not you need to request it before proceeding to get the data from the internal storage.
I will fix it in the repository and push it to Github as fast as I can.
Kind regards, Gabriel Tanner
Oh that's cool. 😍
On Tue, Aug 6, 2019 at 6:52 PM Tanner Gabriel notifications@github.com wrote:
Hey @ultrasamad https://github.com/ultrasamad ,
I think that this is an issue with the storage permission which has to be requested in realtime on newer Android versions. This can be done by checking if the permission has already been accepted in our MainActivity.kt file. If not you need to request it before proceeding to get the data from the internal storage.
I will fix it in the repository and push it to Github as fast as I can.
Kind regards, Gabriel Tanner
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TannerGabriel/android-sound-recorder/issues/1?email_source=notifications&email_token=ACF5DE5HGHXVDFL45HE2VPLQDHB6XA5CNFSM4IHPKVG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3WDSDY#issuecomment-518797583, or mute the thread https://github.com/notifications/unsubscribe-auth/ACF5DE3SMGVNTGPGKQV7LLTQDHB6XANCNFSM4IHPKVGQ .
Should be fixed now. Try it out and tell me if it helped.
Kind regards, Gabriel Tanner
Issue resolved. Thanks
I cloned the repository, built and run I got the below error on Logcat. I tested on a real device running on android 9.
2019-07-29 06:57:51.776 9144-9144/com.example.gabriel.soundrecorder E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.gabriel.soundrecorder, PID: 9144 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gabriel.soundrecorder/com.example.gabriel.soundrecorder.MainActivity}: java.lang.RuntimeException: setAudioSource failed. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) 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:858) Caused by: java.lang.RuntimeException: setAudioSource failed. at android.media.MediaRecorder.setAudioSource(Native Method) at com.example.gabriel.soundrecorder.recorder.RecorderRepository.<init>(RecorderRepository.kt:55) at com.example.gabriel.soundrecorder.recorder.RecorderRepository$Companion.getInstance(RecorderRepository.kt:25) at com.example.gabriel.soundrecorder.util.InjectorUtils.provideRecorderViewModelFactory(InjectorUtil.kt:11) at com.example.gabriel.soundrecorder.MainActivity.initUI(MainActivity.kt:69) at com.example.gabriel.soundrecorder.MainActivity.onCreate(MainActivity.kt:31) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) 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:858)