exposed beyond app through ClipData.Item.getUri()How to attach pdf file from assets in email?when take photo get - java.lang.Throwable: file:// Uri exposed through ClipData.Item.getUri()android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()Can't receive the push notification messageandroid.os.FileUriExposedException: file.jpg exposed beyond app through ClipData.Item.getUri()App is crashing when taken picture using ACTION_IMAGE_CAPTURE on some devices?exposed beyond app through ClipData.Item.getUriandroid.os.FileUriExposedException: file:///storage/emulated/0/Pictures/picFolder/1.jpg exposed beyond app through ClipData.Item.getUri()Volley gets 400 Bad request in lollipop device but works with postmanfile://null exposed beyond app through ClipData.Item.getUri
Invariance of results when scaling explanatory variables in logistic regression, is there a proof?
Java - What do constructor type arguments mean when placed *before* the type?
What do you call the infoboxes with text and sometimes images on the side of a page we find in textbooks?
Can the harmonic series explain the origin of the major scale?
Bob has never been a M before
Meta programming: Declare a new struct on the fly
Female=gender counterpart?
Books on the History of math research at European universities
Is it okay / does it make sense for another player to join a running game of Munchkin?
Can I rely on these GitHub repository files?
Word describing multiple paths to the same abstract outcome
Pronouncing Homer as in modern Greek
Why does this part of the Space Shuttle launch pad seem to be floating in air?
Hostile work environment after whistle-blowing on coworker and our boss. What do I do?
How to check participants in at events?
Simulating a probability of 1 of 2^N with less than N random bits
The most efficient algorithm to find all possible integer pairs which sum to a given integer
How to deal with or prevent idle in the test team?
My boss asked me to take a one-day class, then signs it up as a day off
Does "Dominei" mean something?
Is there an wasy way to program in Tikz something like the one in the image?
node command while defining a coordinate in TikZ
Golf game boilerplate
Visiting the UK as unmarried couple
exposed beyond app through ClipData.Item.getUri()
How to attach pdf file from assets in email?when take photo get - java.lang.Throwable: file:// Uri exposed through ClipData.Item.getUri()android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()Can't receive the push notification messageandroid.os.FileUriExposedException: file.jpg exposed beyond app through ClipData.Item.getUri()App is crashing when taken picture using ACTION_IMAGE_CAPTURE on some devices?exposed beyond app through ClipData.Item.getUriandroid.os.FileUriExposedException: file:///storage/emulated/0/Pictures/picFolder/1.jpg exposed beyond app through ClipData.Item.getUri()Volley gets 400 Bad request in lollipop device but works with postmanfile://null exposed beyond app through ClipData.Item.getUri
My API Version is 24
I'm using Camera and Bluetooth. And my device communicating other device.
The first function is, I'm going to call up the camera app from my app, take a picture and send it to other device.
The second function is, I want to import the file I want to send and send it to another device through Bluetooth.
These two can be run on different projects, but two cannot be executed within one project.
this is my error "Caused by: android.os.FileUriExposedException: file:///sdcard/Download/example.txt exposed beyond app through ClipData.Item.getUri()"
I'll put a piece of the code up.
CameraActivity.class
private void sendTakePhotoIntent()
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null)
try
photoFile = createImageFile();
catch (IOException ex)
// Error occurred while creating the File
if (photoFile != null)
photoUri = FileProvider.getUriForFile(this, getPackageName(), photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
Bluetooth.class
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
if (resultCode == DISCOVER_DURATION && requestCode == REQUEST_BLU)
Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.setType("*/*");
File file = new File(exist);
i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(i, 0);
if (list.size() > 0)
String packageName = null;
String className = null;
boolean found = false;
for (ResolveInfo info : list)
packageName = info.activityInfo.packageName;
if (packageName.equals("com.android.bluetooth"))
className = info.activityInfo.name;
found = true;
break;
if (!found)
Toast.makeText(this, "Bluetooth not been found", Toast.LENGTH_LONG).show();
else
i.setClassName(packageName, className);
startActivity(i);
else
Toast.makeText(this, "Bluetooth is cancelled", Toast.LENGTH_LONG).show();
Manifests.xml - provider
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.tech.www.communicatever_110"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
res/xml/file_paths.xml
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_images" path="Android/data/com.tech.www.communicatever_110/files/Pictures" />
If you need any more code, please request it.
android bluetooth camera communicate
add a comment |
My API Version is 24
I'm using Camera and Bluetooth. And my device communicating other device.
The first function is, I'm going to call up the camera app from my app, take a picture and send it to other device.
The second function is, I want to import the file I want to send and send it to another device through Bluetooth.
These two can be run on different projects, but two cannot be executed within one project.
this is my error "Caused by: android.os.FileUriExposedException: file:///sdcard/Download/example.txt exposed beyond app through ClipData.Item.getUri()"
I'll put a piece of the code up.
CameraActivity.class
private void sendTakePhotoIntent()
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null)
try
photoFile = createImageFile();
catch (IOException ex)
// Error occurred while creating the File
if (photoFile != null)
photoUri = FileProvider.getUriForFile(this, getPackageName(), photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
Bluetooth.class
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
if (resultCode == DISCOVER_DURATION && requestCode == REQUEST_BLU)
Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.setType("*/*");
File file = new File(exist);
i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(i, 0);
if (list.size() > 0)
String packageName = null;
String className = null;
boolean found = false;
for (ResolveInfo info : list)
packageName = info.activityInfo.packageName;
if (packageName.equals("com.android.bluetooth"))
className = info.activityInfo.name;
found = true;
break;
if (!found)
Toast.makeText(this, "Bluetooth not been found", Toast.LENGTH_LONG).show();
else
i.setClassName(packageName, className);
startActivity(i);
else
Toast.makeText(this, "Bluetooth is cancelled", Toast.LENGTH_LONG).show();
Manifests.xml - provider
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.tech.www.communicatever_110"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
res/xml/file_paths.xml
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_images" path="Android/data/com.tech.www.communicatever_110/files/Pictures" />
If you need any more code, please request it.
android bluetooth camera communicate
add a comment |
My API Version is 24
I'm using Camera and Bluetooth. And my device communicating other device.
The first function is, I'm going to call up the camera app from my app, take a picture and send it to other device.
The second function is, I want to import the file I want to send and send it to another device through Bluetooth.
These two can be run on different projects, but two cannot be executed within one project.
this is my error "Caused by: android.os.FileUriExposedException: file:///sdcard/Download/example.txt exposed beyond app through ClipData.Item.getUri()"
I'll put a piece of the code up.
CameraActivity.class
private void sendTakePhotoIntent()
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null)
try
photoFile = createImageFile();
catch (IOException ex)
// Error occurred while creating the File
if (photoFile != null)
photoUri = FileProvider.getUriForFile(this, getPackageName(), photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
Bluetooth.class
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
if (resultCode == DISCOVER_DURATION && requestCode == REQUEST_BLU)
Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.setType("*/*");
File file = new File(exist);
i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(i, 0);
if (list.size() > 0)
String packageName = null;
String className = null;
boolean found = false;
for (ResolveInfo info : list)
packageName = info.activityInfo.packageName;
if (packageName.equals("com.android.bluetooth"))
className = info.activityInfo.name;
found = true;
break;
if (!found)
Toast.makeText(this, "Bluetooth not been found", Toast.LENGTH_LONG).show();
else
i.setClassName(packageName, className);
startActivity(i);
else
Toast.makeText(this, "Bluetooth is cancelled", Toast.LENGTH_LONG).show();
Manifests.xml - provider
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.tech.www.communicatever_110"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
res/xml/file_paths.xml
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_images" path="Android/data/com.tech.www.communicatever_110/files/Pictures" />
If you need any more code, please request it.
android bluetooth camera communicate
My API Version is 24
I'm using Camera and Bluetooth. And my device communicating other device.
The first function is, I'm going to call up the camera app from my app, take a picture and send it to other device.
The second function is, I want to import the file I want to send and send it to another device through Bluetooth.
These two can be run on different projects, but two cannot be executed within one project.
this is my error "Caused by: android.os.FileUriExposedException: file:///sdcard/Download/example.txt exposed beyond app through ClipData.Item.getUri()"
I'll put a piece of the code up.
CameraActivity.class
private void sendTakePhotoIntent()
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null)
try
photoFile = createImageFile();
catch (IOException ex)
// Error occurred while creating the File
if (photoFile != null)
photoUri = FileProvider.getUriForFile(this, getPackageName(), photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
Bluetooth.class
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
if (resultCode == DISCOVER_DURATION && requestCode == REQUEST_BLU)
Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.setType("*/*");
File file = new File(exist);
i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(i, 0);
if (list.size() > 0)
String packageName = null;
String className = null;
boolean found = false;
for (ResolveInfo info : list)
packageName = info.activityInfo.packageName;
if (packageName.equals("com.android.bluetooth"))
className = info.activityInfo.name;
found = true;
break;
if (!found)
Toast.makeText(this, "Bluetooth not been found", Toast.LENGTH_LONG).show();
else
i.setClassName(packageName, className);
startActivity(i);
else
Toast.makeText(this, "Bluetooth is cancelled", Toast.LENGTH_LONG).show();
Manifests.xml - provider
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.tech.www.communicatever_110"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
res/xml/file_paths.xml
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_images" path="Android/data/com.tech.www.communicatever_110/files/Pictures" />
If you need any more code, please request it.
android bluetooth camera communicate
android bluetooth camera communicate
edited Mar 8 at 7:59
신승한
asked Mar 8 at 7:54
신승한신승한
12
12
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058887%2fexposed-beyond-app-through-clipdata-item-geturi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058887%2fexposed-beyond-app-through-clipdata-item-geturi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown