Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-android
Commits
7c822eb1
Commit
7c822eb1
authored
4 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
conversation: fix recording audio/video messages on Android 11
Change-Id: I364db0b3660774c5e2ddaf4d4ba4abda0a443a9c
parent
b53e0bc4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ring-android/app/src/main/java/cx/ring/fragments/ConversationFragment.java
+14
-23
14 additions, 23 deletions
...src/main/java/cx/ring/fragments/ConversationFragment.java
with
14 additions
and
23 deletions
ring-android/app/src/main/java/cx/ring/fragments/ConversationFragment.java
+
14
−
23
View file @
7c822eb1
...
@@ -533,18 +533,13 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
...
@@ -533,18 +533,13 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
if
(!
presenter
.
getDeviceRuntimeService
().
hasAudioPermission
())
{
if
(!
presenter
.
getDeviceRuntimeService
().
hasAudioPermission
())
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
RECORD_AUDIO
},
REQUEST_CODE_CAPTURE_AUDIO
);
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
RECORD_AUDIO
},
REQUEST_CODE_CAPTURE_AUDIO
);
}
else
{
}
else
{
try
{
Context
ctx
=
requireContext
();
Context
ctx
=
requireContext
();
Intent
intent
=
new
Intent
(
MediaStore
.
Audio
.
Media
.
RECORD_SOUND_ACTION
);
Intent
intent
=
new
Intent
(
MediaStore
.
Audio
.
Media
.
RECORD_SOUND_ACTION
);
if
(
intent
.
resolveActivity
(
ctx
.
getPackageManager
())
!=
null
)
{
try
{
mCurrentPhoto
=
AndroidFileUtils
.
createAudioFile
(
ctx
);
mCurrentPhoto
=
AndroidFileUtils
.
createAudioFile
(
ctx
);
}
catch
(
IOException
ex
)
{
Log
.
e
(
TAG
,
"takePicture: error creating temporary file"
,
ex
);
return
;
}
startActivityForResult
(
intent
,
REQUEST_CODE_CAPTURE_AUDIO
);
startActivityForResult
(
intent
,
REQUEST_CODE_CAPTURE_AUDIO
);
}
else
{
}
catch
(
Exception
ex
)
{
Log
.
e
(
TAG
,
"sendAudioMessage: error"
,
ex
);
Toast
.
makeText
(
getActivity
(),
"Can't find audio recorder app"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getActivity
(),
"Can't find audio recorder app"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
}
...
@@ -554,21 +549,17 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
...
@@ -554,21 +549,17 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
if
(!
presenter
.
getDeviceRuntimeService
().
hasVideoPermission
())
{
if
(!
presenter
.
getDeviceRuntimeService
().
hasVideoPermission
())
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
CAMERA
},
REQUEST_CODE_CAPTURE_VIDEO
);
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
CAMERA
},
REQUEST_CODE_CAPTURE_VIDEO
);
}
else
{
}
else
{
try
{
Context
context
=
requireContext
();
Context
context
=
requireContext
();
Intent
intent
=
new
Intent
(
MediaStore
.
ACTION_VIDEO_CAPTURE
);
Intent
intent
=
new
Intent
(
MediaStore
.
ACTION_VIDEO_CAPTURE
);
intent
.
putExtra
(
"android.intent.extras.CAMERA_FACING"
,
android
.
hardware
.
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
);
intent
.
putExtra
(
"android.intent.extras.CAMERA_FACING"
,
android
.
hardware
.
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
);
intent
.
putExtra
(
"android.intent.extras.LENS_FACING_FRONT"
,
1
);
intent
.
putExtra
(
"android.intent.extras.LENS_FACING_FRONT"
,
1
);
intent
.
putExtra
(
"android.intent.extra.USE_FRONT_CAMERA"
,
true
);
intent
.
putExtra
(
"android.intent.extra.USE_FRONT_CAMERA"
,
true
);
if
(
intent
.
resolveActivity
(
context
.
getPackageManager
())
!=
null
)
{
try
{
mCurrentPhoto
=
AndroidFileUtils
.
createVideoFile
(
context
);
mCurrentPhoto
=
AndroidFileUtils
.
createVideoFile
(
context
);
}
catch
(
IOException
ex
)
{
Log
.
e
(
TAG
,
"takePicture: error creating temporary file"
,
ex
);
return
;
}
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
ContentUriHandler
.
getUriForFile
(
context
,
ContentUriHandler
.
AUTHORITY_FILES
,
mCurrentPhoto
));
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
ContentUriHandler
.
getUriForFile
(
context
,
ContentUriHandler
.
AUTHORITY_FILES
,
mCurrentPhoto
));
startActivityForResult
(
intent
,
REQUEST_CODE_CAPTURE_VIDEO
);
startActivityForResult
(
intent
,
REQUEST_CODE_CAPTURE_VIDEO
);
}
else
{
}
catch
(
Exception
ex
)
{
Log
.
e
(
TAG
,
"sendVideoMessage: error"
,
ex
);
Toast
.
makeText
(
getActivity
(),
"Can't find video recorder app"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getActivity
(),
"Can't find video recorder app"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment