2013-05-26 50 views
6

我想通過藍牙使用我的應用程序發送文件。 我已經改變了MIME類型的東西隨機的,因爲asdxasd/asdxa 和文件有一個擴展,我需要使用,這是.sso與藍牙選項只分享意圖

當我使用它僅出現在藍牙和Gmail選項份額的意圖,但我不能從列表中刪除gmail選項?

非常感謝! 我使用此代碼使用意圖發送:

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")); 

回答

12
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")); 
+0

非常感謝隊友!這正是我正在尋找的^^ – TiagoM

+1

@DarkLink很高興幫助你:) – Bishan

2

,如果您有設備的圖像的路徑,然後使用:

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"));