|
|
@ -10,6 +10,7 @@ import android.content.Intent; |
|
|
|
import android.content.pm.PackageManager; |
|
|
|
import android.content.pm.PackageManager; |
|
|
|
import android.content.pm.ResolveInfo; |
|
|
|
import android.content.pm.ResolveInfo; |
|
|
|
import android.net.Uri; |
|
|
|
import android.net.Uri; |
|
|
|
|
|
|
|
import android.os.Build; |
|
|
|
import android.os.Environment; |
|
|
|
import android.os.Environment; |
|
|
|
import android.support.v7.app.AlertDialog; |
|
|
|
import android.support.v7.app.AlertDialog; |
|
|
|
import android.text.TextUtils; |
|
|
|
import android.text.TextUtils; |
|
|
@ -63,6 +64,11 @@ public class DownloadHandler { |
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW); |
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW); |
|
|
|
intent.setDataAndType(Uri.parse(url), mimetype); |
|
|
|
intent.setDataAndType(Uri.parse(url), mimetype); |
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
|
|
|
|
|
|
|
intent.addCategory(Intent.CATEGORY_BROWSABLE); |
|
|
|
|
|
|
|
intent.setComponent(null); |
|
|
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { |
|
|
|
|
|
|
|
intent.setSelector(null); |
|
|
|
|
|
|
|
} |
|
|
|
ResolveInfo info = context.getPackageManager().resolveActivity(intent, |
|
|
|
ResolveInfo info = context.getPackageManager().resolveActivity(intent, |
|
|
|
PackageManager.MATCH_DEFAULT_ONLY); |
|
|
|
PackageManager.MATCH_DEFAULT_ONLY); |
|
|
|
if (info != null) { |
|
|
|
if (info != null) { |
|
|
|