Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
b9d82d88
Unverified
Commit
b9d82d88
authored
Feb 20, 2020
by
singhalsara8
Committed by
GitHub
Feb 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add permission for write external storage in sound recorder (#2021)
parent
13653adc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
appinventor/components/src/com/google/appinventor/components/runtime/SoundRecorder.java
.../google/appinventor/components/runtime/SoundRecorder.java
+14
-17
No files found.
appinventor/components/src/com/google/appinventor/components/runtime/SoundRecorder.java
View file @
b9d82d88
...
@@ -18,6 +18,7 @@ import com.google.appinventor.components.common.ComponentCategory;
...
@@ -18,6 +18,7 @@ import com.google.appinventor.components.common.ComponentCategory;
import
com.google.appinventor.components.common.PropertyTypeConstants
;
import
com.google.appinventor.components.common.PropertyTypeConstants
;
import
com.google.appinventor.components.common.YaVersion
;
import
com.google.appinventor.components.common.YaVersion
;
import
com.google.appinventor.components.runtime.errors.PermissionException
;
import
com.google.appinventor.components.runtime.errors.PermissionException
;
import
com.google.appinventor.components.runtime.util.BulkPermissionRequest
;
import
com.google.appinventor.components.runtime.util.ErrorMessages
;
import
com.google.appinventor.components.runtime.util.ErrorMessages
;
import
com.google.appinventor.components.runtime.util.FileUtil
;
import
com.google.appinventor.components.runtime.util.FileUtil
;
import
android.Manifest
;
import
android.Manifest
;
...
@@ -158,22 +159,18 @@ public final class SoundRecorder extends AndroidNonvisibleComponent
...
@@ -158,22 +159,18 @@ public final class SoundRecorder extends AndroidNonvisibleComponent
*/
*/
@SimpleFunction
@SimpleFunction
public
void
Start
()
{
public
void
Start
()
{
// Need to check if we have RECORD_AUDIO permission
// Need to check if we have RECORD_AUDIO and WRITE_EXTERNAL permissions
if
(!
havePermission
)
{
if
(!
havePermission
)
{
final
SoundRecorder
me
=
this
;
final
SoundRecorder
me
=
this
;
form
.
runOnUiThread
(
new
Runnable
()
{
form
.
runOnUiThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
form
.
askPermission
(
Manifest
.
permission
.
RECORD_AUDIO
,
form
.
askPermission
(
new
BulkPermissionRequest
(
me
,
"Start"
,
new
PermissionResultHandler
(
)
{
Manifest
.
permission
.
RECORD_AUDIO
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
{
@Override
@Override
public
void
HandlePermissionResponse
(
String
permission
,
boolean
granted
)
{
public
void
onGranted
()
{
if
(
granted
)
{
me
.
havePermission
=
true
;
me
.
havePermission
=
true
;
me
.
Start
();
me
.
Start
();
}
else
{
form
.
dispatchPermissionDeniedEvent
(
me
,
"Start"
,
Manifest
.
permission
.
RECORD_AUDIO
);
}
}
}
});
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment