package com.webview.splashScreen;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.webkit.DownloadListener;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.SlidingDrawer;
import android.widget.SlidingDrawer.OnDrawerCloseListener;
import android.widget.SlidingDrawer.OnDrawerOpenListener;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
/**
* This is actually the main <code>Activity</code> which will handle your web
* site to become one real Android application.
*
* @author |dmb TEAM|
*
*/
@SuppressWarnings("deprecation")
public class WebViewActivity extends Activity {
// -------------------AdMob configuration -------------------
/**
* Boolean flag for enable/disable AdMob funtionality
*/
private static boolean isAdmobEnable = true;
/**
* Your AdMob publisher id. Please add it between "" symbols. The
* advertisements will not be displayed without your publisher id
*/
private String MY_AD_UNIT_ID = "ca-app-pub-2866161942xxxxx/xxxxxx";
// ----------------------------------------------------------
// ------------- Slider position configuration --------------
/**
* Boolean flag that manage the position of the tabbar. Set it to true if
* you want the tabbar to be at the bottom of your screen or set it to false
* for right position of the tabbar.
*/
private static boolean sliderBottom = true;
// ----------------------------------------------------------
/**
* Parent view of the current activity
*/
private RelativeLayout parentView;
/**
* The view object that displays the advertisement
*/
private AdView adView;
/**
* Boolean needed to display correct the loading animation when switching
* between tabs
*/
private static boolean isLoading;
/**
* The top progress displaying when pages are loading
*/
private ProgressBar webviewProgress;
/**
* Callbacks needed for various of functionalities
*/
private ValueCallback<Uri> mUploadMessage;
/**
* Value needed for choose file funtionlities
*/
private final static int FILECHOOSER_RESULTCODE = 1;
/**
* Main URL for the site
*/
private static final String URL = "http://dmb-team.com/webview/";
/**
* The view that shows the web-sites
*/
private WebView webview;
/**
* Layouts containing the image and the text of the menu items in the bottom
* menu.
*/
private LinearLayout scrollContent;
/**
* The arrow button that opens and closes the sliding menu in the bottom.
*/
private Button slideButton;
/**
* The sliding menu in the bottom.
*/
private SlidingDrawer slidingDrawer;
/**
* Scroller of the items in the bottom menu.
*/
private View scroller;
private ProgressDialog mProgressDialog;
/**
* Custom view to be showed when video full screen button is clicked
*/
private View mCustomView;
/**
* The container for the mCustomView
*/
private FrameLayout mCustomViewContainer;
/**
* A listener for the showed mCustomView enabling the back button click
*/
private WebChromeClient.CustomViewCallback mCustomViewCallback;
/**
* Custom WebChromeClient
*/
private MyWebChromeClient mWebChromeClient;
/**
* Called when the activity is starting. This is where most initialization
* should go.
*
* @param savedInstanceState
* If the activity is being re-initialized after previously being
* shut down then this <code>Bundle</code> contains the data it
* most recently supplied in
* <code>onSaveInstanceState(Bundle)</code>. Note: Otherwise it
* is null.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.main);
webview = (WebView) findViewById(R.id.webview);
if (isOnline()) {
parentView = (RelativeLayout) findViewById(R.id.parent_rl);
webviewProgress = (ProgressBar) findViewById(R.id.webview_progress);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setAllowFileAccess(true);
webview.setWebViewClient(new MyWebViewClient());
webview.getSettings().setPluginState(WebSettings.PluginState.ON);
/* The UserAgentString is change, because the app doesn't display mobile versions of bwesites */
webview.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");
webview.loadUrl(URL);
webviewProgress.setProgress(0);
mWebChromeClient = new MyWebChromeClient();
webview.setWebChromeClient(mWebChromeClient);
webview.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
mProgressDialog = new ProgressDialog(WebViewActivity.this);
mProgressDialog.setMessage("Downloading...");
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog
.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
DownloadFile downloadFile = new DownloadFile();
downloadFile.execute(url);
}
});
initSlider();
initAdmob();
} else {
displayErrorPage();
}
}
/**
* When when file was chosen
*/
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage)
return;
Uri result = intent == null || resultCode != RESULT_OK ? null
: intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
}
}
/**
* Android back button litener
*/
@Override
public void onBackPressed() {
if (mCustomViewContainer != null)
mWebChromeClient.onHideCustomView();
else if (webview.canGoBack())
webview.goBack();
else
super.onBackPressed();
}
/**
* Removes the Slider from the application
*/
@SuppressWarnings("unused")
private void removeSlider() {
FrameLayout mainLayout = (FrameLayout) findViewById(R.id.framelayout);
mainLayout.removeView(slidingDrawer);
slidingDrawer = null;
scroller = null;
slideButton = null;
scrollContent = null;
}
/**
* Creates the slider for the application
*/
private void initSlider() {
FrameLayout mainLayout = (FrameLayout) findViewById(R.id.framelayout);
slidingDrawer = getSlidingDrawer(mainLayout);
scroller = (View) findViewById(R.id.scroller);
slideButton = (Button) findViewById(R.id.sliderbutton);
slidingDrawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
public void onDrawerOpened() {
if (isSliderBottom()) {
slideButton.setBackgroundResource(R.drawable.closearrow);
} else {
slideButton.setBackgroundResource(R.drawable.horclosearrow);
if (isAdmobEnable) {
scrollContent.setPadding(0, adView.getHeight(), 0, 0);
}
}
scroller.setBackgroundColor(getResources().getColor(R.color.translucent_white));
}
});
slidingDrawer.setOnDrawerCloseListener(new OnDrawerCloseListener() {
public void onDrawerClosed() {
if (isSliderBottom()) {
slideButton.setBackgroundResource(R.drawable.openarrow);
} else {
slideButton.setBackgroundResource(R.drawable.horopenarrow);
}
scroller.setBackgroundColor(Color.TRANSPARENT);
}
});
scrollContent = (LinearLayout) findViewById(R.id.scrollcontent);
for (LinearLayout tab : getTabs()) {
scrollContent.addView(tab);
}
}
/**
* Returns the <code>SlidingDrawer</code> object depending on the settings
*
* @param mainLayout
* the main layout of the activity
* @return <code>SlidingDrawer</code> object
*/
private SlidingDrawer getSlidingDrawer(FrameLayout mainLayout) {
SlidingDrawer drawer;
if (isSliderBottom()) {
drawer = (SlidingDrawer) getLayoutInflater().inflate(
R.layout.verslidingdrawer, mainLayout, false);
} else {
drawer = (SlidingDrawer) getLayoutInflater().inflate(
R.layout.horslidingdrawer, mainLayout, false);
}
mainLayout.addView(drawer);
return drawer;
}
/**
* Returns list of <code>TabContent</code> objects containing all the
* information about the tabs in the application
*
* @return list of <code>TabContent</code> objects
*/
private List<TabContent> getTabsContent() {
List<TabContent> tabsContent = new ArrayList<TabContent>();
tabsContent.add(new TabContent(R.drawable.tab_home, "Home",
"http://www.dmb-team.com/webview"));
tabsContent.add(new TabContent(R.drawable.tab_about, "About Us",
"http://www.macrobusiness.com.au/"));
tabsContent.add(new TabContent(R.drawable.tab_download, "Download",
"http://dmb-team.com/webview/download.html"));
tabsContent.add(new TabContent(R.drawable.tab_portfolio, "Portfolio",
"http://dmb-team.com/webview/portfolio.html"));
tabsContent.add(new TabContent(R.drawable.tab_contact, "Contact Us",
"http://dmb-team.com/webview/contact.html"));
tabsContent.add(new TabContent(R.drawable.tab_youtube, "YouTube",
"http://dmb-team.com/webview/youtube.html"));
/*
* tabsContent.add(new TabContent(R.drawable.tab_about, "Rate",
* "market://details?id=" + getPackageName()));
*/
return tabsContent;
}
/**
* Returns a list of the tabs <code>LinearLayout</code> objects.
*
* @return list of <code>LinearLayout</code> objects
*/
private List<LinearLayout> getTabs() {
List<LinearLayout> tabs = new ArrayList<LinearLayout>();
for (TabContent tabContent : getTabsContent()) {
tabs.add(getTab(tabContent));
}
return tabs;
}
/**
* Returns a single tab by given <code>TabContent</code>
*
* @param tabContent
* - the content of the given tab
* @return tab <code>LinearLayout</code>
*/
private LinearLayout getTab(TabContent tabContent) {
LinearLayout tab = (LinearLayout) getLayoutInflater().inflate(
R.layout.tabcontent, null, false);
ImageView image = (ImageView) getLayoutInflater().inflate(
R.layout.tabimage, null, false);
image.setImageResource(tabContent.getImage());
TextView text = (TextView) getLayoutInflater().inflate(
R.layout.tabtext, null, false);
text.setText(tabContent.getText());
tab.addView(image);
tab.addView(text);
final String url = tabContent.getUrl();
tab.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
slidingDrawer.close();
webview.loadUrl(url);
}
});
return tab;
}
/**
* Initialize admob advertisement object if admob is enabled. Put it in the
* correct position.
*/
private void initAdmob() {
if (isAdmobEnable) {
adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(MY_AD_UNIT_ID);
RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
p.addRule(RelativeLayout.BELOW, webviewProgress.getId());
// p.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
parentView.addView(adView, p);
AdRequest adRequest = new AdRequest.Builder().build();
// Start loading the ad in the background.
adView.loadAd(adRequest);
}
}
/**
* Returns <code>true</code> if the slider is positioned in the bottom.
* Returns <code>false</code> otherwise
*
* @return whether the slider is bottom or side positioned
*/
public boolean isSliderBottom() {
return sliderBottom;
}
/**
* Called when a key was pressed down and not handled by any of the views
* inside of the activity. So, for example, key presses while the cursor is
* inside a TextView will not trigger the event (unless it is a navigation
* to another object) because TextView handles its own key presses.
*
* If the focused view didn't want this event, this method is called.
*
* The default implementation takes care of KEYCODE_BACK by calling
* onBackPressed(), though the behavior varies based on the application
* compatibility mode: for ECLAIR or later applications, it will set up the
* dispatch to call onKeyUp(int, KeyEvent) where the action will be
* performed; for earlier applications, it will perform the action
* immediately in on-down, as those versions of the platform behaved.
*
* Other additional default key handling may be performed if configured with
* setDefaultKeyMode(int).
*
* @param keyCode
* The value in event.getKeyCode().
* @param event
* Description of the key event.
* @return Return true to prevent this event from being propagated further,
* or false to indicate that you have not handled this event and it
* should continue to be propagated.
*/
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && isOnline()
&& webview.canGoBack()) {
webview.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
/**
* Return the inflater needed to load different UI elements
*
* @return system inflater
*/
public LayoutInflater getInflater() {
return (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
/**
* Checks if the device is connected to Internet
*
* @return true if the device is connected
*/
public boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnected()) {
return true;
}
return false;
}
/**
* Display error page when not connection available
*/
private void displayErrorPage() {
if (webview != null) {
webview.loadUrl("file:///android_asset/error_page.html");
}
}
/**
* Custom <code>WebViewClient</code> overriding
* <code>shouldOverrideUrlLoading(WebView view, String url)</code> method
*
* @author |dmb TEAM|
*
*/
private class MyWebViewClient extends WebViewClient {
/**
* Executed when webpage is star to loading. Display loading animation
* during that loading.
*/
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
if (isOnline()) {
if (!isLoading) {
MyProgressDialog.show(WebViewActivity.this, null, null);
isLoading = true;
}
} else {
displayErrorPage();
}
}
/**
* Executed when webpage is already loaded. Hide the loading animation.
*/
@Override
public void onPageFinished(WebView view, String url) {
if (isOnline()) {
if (isLoading) {
MyProgressDialog.dismisIt();
isLoading = false;
}
}
}
/**
* Give the host application a chance to take over the control when a
* new url is about to be loaded in the current WebView. If
* WebViewClient is not provided, by default WebView will ask Activity
* Manager to choose the proper handler for the url. If WebViewClient is
* provided, return true means the host application handles the url,
* while return false means the current WebView handles the url.
*
* @param view
* The WebView that is initiating the callback.
* @param url
* The url to be loaded.
* @return True if the host application wants to leave the current
* WebView and handle the url itself, otherwise return false.
*/
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.endsWith(".mp4")) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "video/*");
startActivity(intent);
return true;
} else if (url.endsWith(".mp3")) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "audio/*");
startActivity(intent);
return true;
} else if (url.startsWith("tel:")) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
startActivity(intent);
return true;
} else if (url.startsWith("mailto:")) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent,
"Select email application."));
} else {
view.loadUrl(url);
}
return true;
}
}
/**
* Class representing all the data needed for a single Tab in the
* application
*
* @author |dmb TEAM|
*
*/
private class TabContent {
/**
* Image file resource
*/
private Integer image;
/**
* Text of the tab
*/
private String text;
/**
* Url invoked on click on the tab
*/
private String url;
/**
* Constructor
*
* @param image
* - Image file resource
* @param text
* - Text of the tab
* @param url
* - URL invoked on click on the tab
*/
public TabContent(Integer image, String text, String url) {
super();
this.image = image;
this.text = text;
this.url = url;
}
/**
* Returns the image of the tab
*
* @return the resource id of the image
*/
public Integer getImage() {
return image;
}
/**
* Returns the text of the tab
*
* @return text of the tab
*/
public String getText() {
return text;
}
/**
* Returns the URL of the tab
*
* @return URL of the tab
*/
public String getUrl() {
return url;
}
}
/**
* Chrome client for the webview. Needs in more specific case as file opens
* in the webview or progressBar state updating
*/
private class MyWebChromeClient extends WebChromeClient {
FrameLayout.LayoutParams LayoutParameters = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
/**
* Show custom view. Most often video full screen view.
*/
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
// if a view already exists then immediately terminate the new one
if (mCustomView != null) {
callback.onCustomViewHidden();
return;
}
parentView.setVisibility(View.GONE);
mCustomViewContainer = new FrameLayout(WebViewActivity.this);
mCustomViewContainer.setLayoutParams(LayoutParameters);
mCustomViewContainer.setBackgroundResource(android.R.color.black);
view.setLayoutParams(LayoutParameters);
mCustomViewContainer.addView(view);
mCustomView = view;
mCustomViewCallback = callback;
mCustomViewContainer.setVisibility(View.VISIBLE);
setContentView(mCustomViewContainer);
}
/**
* Hide the custom view
*/
@Override
public void onHideCustomView() {
if (mCustomView == null) {
return;
} else {
// Hide the custom view.
mCustomView.setVisibility(View.GONE);
// Remove the custom view from its container.
mCustomViewContainer.removeView(mCustomView);
mCustomView = null;
mCustomViewContainer.setVisibility(View.GONE);
mCustomViewCallback.onCustomViewHidden();
// Show the content view.
parentView.setVisibility(View.VISIBLE);
setContentView(parentView);
}
}
/**
* Manage the loading state of the top bar
*/
public void onProgressChanged(WebView view, int progress) {
webviewProgress.setProgress(progress);
if (progress == 100 || !isOnline()) {
webviewProgress.setVisibility(View.GONE);
} else {
webviewProgress.setVisibility(View.VISIBLE);
}
}
/**
* Open intent to choose app for file uploading for Android 3.0+
*/
public void openFileChooser(ValueCallback<Uri> uploadMsg,
String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
WebViewActivity.this.startActivityForResult(
Intent.createChooser(i, "File Chooser"),
FILECHOOSER_RESULTCODE);
}
/**
* Open intent to choose app for file uploading for Android < 3.0
*/
@SuppressWarnings("unused")
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
openFileChooser(uploadMsg, "");
}
/**
* Open intent to choose app for file uploading for Android >= 4.1
*/
@SuppressWarnings("unused")
public void openFileChooser(ValueCallback<Uri> uploadMsg,
String acceptType, String capture) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
WebViewActivity.this.startActivityForResult(
Intent.createChooser(i, "File Browser"),
FILECHOOSER_RESULTCODE);
}
}
/**
* Use this class to dowload data from given URL. It will not display an
* empty blank page before starting download or something like that(blank
* page in normal behaviour in android webview before start dowload
* something)
*/
private class DownloadFile extends AsyncTask<String, Integer, String> {
/**
* This method is executed in background so it will not freeze the UI
* thread
*/
@Override
protected String doInBackground(String... sUrl) {
String result = null;
try {
String urlString = sUrl[0];
// get the file name in the Normal way
/*
* String fileExtenstion =
* MimeTypeMap.getFileExtensionFromUrl(urlString); String
* fileName = URLUtil.guessFileName(urlString, null,
* fileExtenstion);
*/
// get the filename in strange way, because of the stupid .php
// script
int lastSlash = urlString.lastIndexOf('/');
String fileName = "file.bin";
if (lastSlash >= 0) {
fileName = urlString.substring(lastSlash + 1);
}
if (fileName.equals("")) {
fileName = "file.bin";
}
URL url = new URL(urlString);
// create the new connection
HttpURLConnection urlConnection = (HttpURLConnection) url
.openConnection();
// set up some things on the connection
urlConnection.setRequestMethod("GET");
urlConnection.setDoOutput(true);
// and connect!
urlConnection.connect();
// set the path where we want to save the file
// in this case, going to save it on the root directory of the
// sd card.
File SDCardRoot = Environment.getExternalStorageDirectory();
// create a new file, specifying the path, and the filename
// which we want to save the file as.
File dir = new File(SDCardRoot, "dmb");
dir.mkdir();
File file = new File(dir, fileName);
result = SDCardRoot.getName() + "/dmb/" + fileName;
// this will be used to write the downloaded data into the file
// we created
FileOutputStream fileOutput = new FileOutputStream(file);
// this will be used in reading the data from the internet
InputStream inputStream = urlConnection.getInputStream();
// this is the total size of the file
int totalSize = urlConnection.getContentLength();
// variable to store total downloaded bytes
int downloadedSize = 0;
// create a buffer...
byte[] buffer = new byte[1024];
int bufferLength = 0; // used to store a temporary size of the
// buffer
// now, read through the input buffer and write the contents to
// the file
while ((bufferLength = inputStream.read(buffer)) > 0) {
// add the data in the buffer to the file in the file output
// stream (the file on the sd card
fileOutput.write(buffer, 0, bufferLength);
// add up the size so we know how much is downloaded
downloadedSize += bufferLength;
// this is where you would do something to report the
// prgress, like this maybe
onProgressUpdate(downloadedSize, totalSize);
}
// close the output stream when done
fileOutput.close();
// catch some possible errors...
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
/**
* This is the first method thas is called and it show the progress bar
* loading animation.
*/
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressDialog.show();
}
/**
* Use this method to update the progress of downloading
*/
@Override
protected void onProgressUpdate(Integer... progress) {
super.onProgressUpdate(progress);
mProgressDialog.setProgress(progress[0]);
}
/**
* Use this method to tell the user the download is complete
*/
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
mProgressDialog.dismiss();
if (result != null) {
Toast.makeText(WebViewActivity.this,
"File downloaded in " + result, Toast.LENGTH_LONG)
.show();
}
}
}
} MP3 Dosyaları İnmiyor (Yardım)
4
●580
- 26-05-2015, 01:11:20Arkadaşlar webview yöntemi kullanıyorum. Sitemdeki Mp3 dosyaları inmiyor, kaynak kodlarım aşağıda belirttiğim gibi nerede hata yapılmış olabilir? İniyor gibi gösterip hemen indirme tamamlandı diyor ve dosya 0 KB oluyor. Yardım eden herkese şimdiden teşekkür ederim..
- 26-05-2015, 12:37:25downloadFile.execute(url) kodundanki url degiskeninin degerini debug edip yazarmisin
- 26-05-2015, 15:58:13Hocam bu konularda çok bilgili değilim öncelikle yardım etme isteğiniz için teşekkür ederim, şöyle bir sonuca varıyorum.fmetinkaya adlı üyeden alıntı: mesajı görüntüle
05-26 08:51:31.830: W/System.err(799): java.io.FileNotFoundException: /storage/sdcard/dmb/xxx.mp3: open failed: EACCES (Permission denied) 05-26 08:51:31.840: W/System.err(799): at libcore.io.IoBridge.open(IoBridge.java:409) 05-26 08:51:31.840: W/System.err(799): at java.io.FileOutputStream.<init>(FileOutputStream.java:88) 05-26 08:51:31.850: W/System.err(799): at java.io.FileOutputStream.<init>(FileOutputStream.java:73) 05-26 08:51:31.860: W/System.err(799): at com.webview.splashScreen.WebViewActivity$DownloadFile.doInBackground(WebViewActivity.java:830) 05-26 08:51:31.860: W/System.err(799): at com.webview.splashScreen.WebViewActivity$DownloadFile.doInBackground(WebViewActivity.java:1) 05-26 08:51:31.860: W/System.err(799): at android.os.AsyncTask$2.call(AsyncTask.java:288) 05-26 08:51:31.870: W/System.err(799): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 05-26 08:51:31.870: W/System.err(799): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 05-26 08:51:31.880: W/System.err(799): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 05-26 08:51:31.880: W/System.err(799): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 05-26 08:51:31.890: W/System.err(799): at java.lang.Thread.run(Thread.java:841) 05-26 08:51:31.900: W/System.err(799): Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied) 05-26 08:51:31.900: W/System.err(799): at libcore.io.Posix.open(Native Method) 05-26 08:51:31.910: W/System.err(799): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) 05-26 08:51:31.920: W/System.err(799): at libcore.io.IoBridge.open(IoBridge.java:393) 05-26 08:51:31.920: W/System.err(799): ... 10 more
- 26-05-2015, 16:24:58Androidmanifest.xml dosyasinin icindeki manifest taginin icine <uses-permission android:name="android.permission.WRITE_EXTERNAL_ST ORAGE"/>
Bunu yapistirip deneyebilirmisin - 26-05-2015, 20:59:33Hocam manifest dosyamın içinde gerekli izin yer alıyor ancak yinede aynı hatayı alıyorum.. Dosya indirmesinin tamamlandığı söylüyor ancak dosya telefonda 0KB oluyor ve açılmıyor..fmetinkaya adlı üyeden alıntı: mesajı görüntüle