android-sharing

Getting permission denied when using a URI despite FLAG_GRANT_READ_URI_PERMISSION being set

末鹿安然 提交于 2019-12-25 02:38:12
问题 I have two android apps A and B. I am passing a file from app A to app B and I am seeing that app B is getting the URI. I am setting the FLAG_GRANT_READ_URI_PERMISSION flag in app A and I am seeing that that mFlags is a 1, which is the value of FLAG_GRANT_READ_URI_PERMISSION , from within app B. This is all good, but when I try to create a FileInputStream from the URI, I get a FileNotFoundException (Permission denied) exception. What am I doing wrong? Here are the pertinent code snippets: In

Getting permission denied when using a URI despite FLAG_GRANT_READ_URI_PERMISSION being set

心不动则不痛 提交于 2019-12-25 02:38:08
问题 I have two android apps A and B. I am passing a file from app A to app B and I am seeing that app B is getting the URI. I am setting the FLAG_GRANT_READ_URI_PERMISSION flag in app A and I am seeing that that mFlags is a 1, which is the value of FLAG_GRANT_READ_URI_PERMISSION , from within app B. This is all good, but when I try to create a FileInputStream from the URI, I get a FileNotFoundException (Permission denied) exception. What am I doing wrong? Here are the pertinent code snippets: In

Unable to receive share image - Android 6.0

眉间皱痕 提交于 2019-12-20 04:34:41
问题 I am using the code provided by aFileChooser to get able to get the shared image inside my application. Images from the gallery work OK but if i use an image say inside Google Chrome and try to share it, it gives me a NPE as my imagePath is null. String imagePath = getPath(getActivity(), imageUri); My uri is identified as MediaStore (and) general from this code: else if ("content".equalsIgnoreCase(uri.getScheme())) { if (isGooglePhotosUri(uri)) return uri.getLastPathSegment(); return

sharing failed, in api 23, only failed is for whatsapp, after selecting whatsapp from chooser, it returns back to sharer page

僤鯓⒐⒋嵵緔 提交于 2019-12-17 20:56:36
问题 except whatsapp, my app is sharing content to all other application like hike hangout mail, messenger etc.. my compile sdk and target sdk is 23 this is my code if (url.startsWith("share://")) { Intent share = new Intent(Intent.ACTION_SEND); Uri requestUrl = Uri.parse(url); String pContent = requestUrl.toString().split("share://")[1]; String pasteData = pContent+""; share.setAction(Intent.ACTION_SEND); share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); Toast toast=Toast.makeText

ShareCompat IntentBuilder crashing every time on Android 4

本秂侑毒 提交于 2019-12-13 05:45:06
问题 In one of my activities, I am using the ShareCompat IntentBuilder to allow users to share some text: ShareCompat.IntentBuilder .from(this) .setText("The shared text") .setType("text/plain") .setChooserTitle("Share to") .startChooser(); On Android 5 and above, this works as expected, but on Android 4, I have the following crash every time: android.app.SuperNotCalledException: Activity {android/com.android.internal.app.ChooserActivity} did not call through to super.onStop() at android.app

Share audio file from /data/user/0/ directory using FileProvider

五迷三道 提交于 2019-12-13 03:14:36
问题 I'm using FileProvider API for sharing content actually storing in internal storage. Following is my xml configuration that linked with Provider configured in Manifiest file. <paths xmlns:android="http://schemas.android.com/apk/res/android"> <cache-path name="xs_audio" path="/audio/records"/> </paths> and code that I'm using to share is following: private final static String FILE_PROVIDER = BuildConfig.APPLICATION_ID + ".fileprovider"; private String testPackageAppHaveAccess = "com.whats";

Sharing image from android app

走远了吗. 提交于 2019-12-11 02:48:31
问题 I am trying to share an image from my Android app. I am trying to send it as an Email attachment as well as a photo on WhatsApp. The code is: String imageUrl = Path to image (eg. sdcard/pictures/image1.jpg); shareImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Uri uriToImage= Uri.parse(imageUrl); Log.d("Image", ""+uriToImage); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM,

How to make custom share via screen in android

▼魔方 西西 提交于 2019-12-10 11:05:41
问题 My app has one share feature. So while click on share it should show the list of apps to be shared with. Right now I am using this code Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); startActivity(sendIntent); and it is showing the dialog like this But what I need is , I need to show the share dialog like a grid view like this. Is it possible to do so? How can I

Android sharing image doesn't work

感情迁移 提交于 2019-12-10 04:28:49
问题 I am trying to share a screenshot of the application using the following code: View content = findViewById(R.id.layoutHome); content.setDrawingCacheEnabled(true); Bitmap bitmap = content.getDrawingCache(); File sdCardDirectory = Environment.getExternalStorageDirectory(); File image = new File(sdCardDirectory,"temp.png"); // Encode the file as a PNG image. FileOutputStream outStream; try { outStream = new FileOutputStream(image); bitmap.compress(Bitmap.CompressFormat.PNG, 100, outStream);

How to confirm Android Share Intent is successful or complete

假装没事ソ 提交于 2019-12-10 03:54:18
问题 Is there a way to confirm if a Share intent in Android was successful or unsuccessful? (For example, if I share a Facebook post, I'd like to know if it was successfully posted or know if it was cancelled.) Below is the Android intent code that I use to Share. Currently, it launches a dialog to allow the user to choose which app to share to: Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA