<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/*" />
<!--<data android:mimeType="application/pdf" />-->
<!--<data android:mimeType="application/vnd.ms-excel" />-->
</intent-filter>
Intent intent = getIntent()
String path = null
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
String dataString = intent.getDataString()
String urlDecode = EncodeUtils.urlDecode(dataString)
try {
URL url = new URL(urlDecode)
path = url.getFile()
} catch (MalformedURLException e) {
Log.d(TAG, "onCreate: URL格式化失败")
}
Log.d(TAG, "onCreate: 被微信调起 = " + path)
}
Uri uri = Uri.fromFile(new File(mUrlPath))
Intent intent = new Intent(Intent.ACTION_SEND)
intent.setAction(Intent.ACTION_SEND)
intent.setAction(Intent.ACTION_SEND_MULTIPLE)
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriList)
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.setType("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
intent.putExtra(Intent.EXTRA_STREAM, uri)
intent.putExtra(Intent.EXTRA_SUBJECT, "测试标题")
intent.putExtra(Intent.EXTRA_TEXT, "测试内容")
startActivity(Intent.createChooser(intent, "分享到"))