Share Intent with Bluetooth Option Only

跟風遠走 提交于 2019-12-19 03:12:24

问题


I am trying to send a file over bluetooth using my app. I already changed the mime type to something random as asdxasd/asdxa And the file has an extension that I need to use, that is .sso

When I use the share intent it only appears the bluetooth and gmail option, but can't I delete the gmail option from the list ?

Thanks alot in advance! I am using this code to send it using the intent:

file = new FileSystem(this).saveTemp();

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.fromFile(file);

sharingIntent.setType("test/onlineconfig");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share Config Using"));

回答1:


Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse(picURI);

sharingIntent.setType("image/*");
sharingIntent.setPackage("com.android.bluetooth");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image"));



回答2:


if you have the path of image of device then use :

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/*");
intent.setPackage("com.android.bluetooth");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagepath)));
startActivity(Intent.createChooser(intent, "Share image"));


来源:https://stackoverflow.com/questions/16755732/share-intent-with-bluetooth-option-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!