Downloading fails much more frequently on iOS than on Android? - android

In my iOS project, I use NSURLConnection to download files. My code is just like the http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html document.
In my team's Android project, we use Android's API to download the same files. Nothing special either.
Both the iOS and Android project have the same fail-retry mechanism, and both of them send the same statistic data to server.
The files they trying to download is between 1M to 10M.
The statistic server shows that for the same URL, download failure is 2% on android, but 20% on iOS! Since they are trying to download the same URL, it seems not the server's problem but more like a client issue.
Why iOS download would fail so frequently? Is there any special APIs I should use for iOS, to make the download robust? Currently I'm using NSURLConnection, and I've just found NSURLDownloader which is more convenient to write files. Will they be different for download success percentage?
P.S. the error I got by -
(void) connection: (NSURLConnection *) connection didFailWithError: (NSError *) , is usually -1005, NSURLErrorNetworkConnectionLost.

I'd suggest looking more into why you're getting NSURLErrorNetworkConnectionLost. Even if your device says it's connected, sometimes it could lose the connection and be attempting to regain it before the indicators update accordingly.
This is a good starting point for more information on better dealing with reachability. Checking For Internet Connectivity in Objective C
Otherwise, I recommend you post your download-related code so others can look for possible issues.

Related

Serve static files over http within an android app with WebView

I have a nuxt.js 3 generated javascript app, which is just some html, JS & other assets. My issue is that passing a file://<path>/index.html as a url to a web_view means that assets are broken since all addresses are origin-relative, e.g. /home/index.html, /_nuxt/entry.123456.css, not path-relative like home/index.html. (i think it would not work for subpages anyway, being path-relative)
How to overcome this?
is there any way to set the web_view to know where to get the static files from? there are no other requests from the web_view other than GETs for static assets & changes of location. I'm thinking something like request interception and rewriting the path or even the response. but that sounds just like a server, so:
I guess I'm gonna need a http server. Can you suggest me some simple up-to-date library that can serve files within an android app? Or can you point me to some API from android native toolbox to open a socket and serve static files via http response? Also, will such a server be accessible for other apps, for the whole android device on localhost? I would like to avert that; the only consumer of the files should be the web_view.
To avoid obvious counter-question - but why? It's that I intend to build a hybrid android app, that does simply open a web_view full-screen. I am aware of limitations of such solution and I'm fine with that. The android part is where I'm not well experienced. If this gets too over-complicated, I'm gonna just change the way how to produce the js app in the first place. but nuxt.js is my best option for now.

CURLE_PARTIAL_FILE error for large files with libcurl

I have linked libcurl library (v7.38.0) statically with my C++
application. Using curl, we upload & download files to/from server https. I Have
download fails with the error CURLE_PARTIAL_FILE. This issue occurs
randomly ie., some times the file was downloaded successfully without
issue and some times, the same file fails with the error.
This issue occurs in android platforms. Anyone can show me how to fix that
CURLE_PARTIAL_FILE means that the transfer was aborted before the full contents arrived. That typically means a bad server or a network problem, not a client-side problem.
If you cannot affect the network or server conditions, you probably need to consider ignoring this particular error.

how can I access SVN from an Android device

I've been trying to use SVN Kit to gain access to an SVN repository from an Android app.
Our project is supposed to check for changes to files and download them if they have changed, but still with the ability to rollback to previous versions if nessecary.
I set up a regular Java project, and had no problem using SVN Kit, I logged into the SVN server and retrived a list of the files stored there.
But when I tryed to do this from an Android project all hell broke loose. The VM run out of heap space, just trying to build it and Eclipse went down in sreaming flames mith comments like 'GC overhead limit exceeded'.
I get the impression that this is due to the diffrent type of virtural machine that Android uses, and the SVNKit jars are compiled for a diffrent type of VM.
This Guy claims to have got it working, with what looks like an older version of Android.
Now I have suggested that we use some kind of ftp server approach, uploading new versions of the files, perhaps with seperate files containing versioning information, but I have to explore this path before I write it off as a dead end, or at least suggest that to my boss!
anyu help or suggestions would be greatly appricated.
My answer may not be directly related to SVNKit but would actually try to address the original problem.
As I understand your use-case, you want to download files if they have changed and are trying to use SVN to do this with its update command. I would rather create a simple web-service which should return me the list of files with their checksums or md5Hash. Now I am assuming that only the relevant files are present on the server. Upon receiving the hashes, you can compare them with the hashes on the device and decide to update based on any difference. This approach will work for rollback too as you need to just replace the file on the server with old file and this would be treated as a new one.
As far as heap overflow and out of memory is concerned, they are mostly because of the limited heap space around 10MB.
I created a SVN client based on SVNKit it is available for free here : https://play.google.com/store/apps/details?id=com.valleytg.oasvnlite.android
I am not sure if that will work for your purpose or you have to build your own. If you are looking to build your own, svnkit will not work directly on the android platform. Some of the libraries used by SVNkit are not available on the Android platform.

BIRT, Android and reports

We have an IBM Maximo system that has BIRT reports built in. We are also in the process of writing an Andriod app that needs to be able to run a report (on the server) and get the PDF version back into the app (or at bare minimum, the HTML version of the report). Is there any built-in functionality for this with BIRT or Maximo??
My team have something similar, but we scrapped the idea of using the .rptdesign files stored on the maximo server, and solved it by setting up the BIRT runtime: (Download here).
If you have direct access to the DB you can setup the runtime with the report(s) you need and play around with the parameters.
Say that one have a report called "report1" stored on "localhost:8080" and the report contained 2 parameters called "StartDate" and "EndDate" this is how one would do it:
Instead of using the standard URL with the frameset servlet mapping: "localhost:8080/birt/frameset?__report=report1.rptdesign" and let the user run the report them self, change the servlet mapping to run.
To just run the report, without getting the parameter dialog to provide values for the two parameters, one just have to parse the parameters to the end of the URL - &StartDate=2011-01-01&EndDate=2011-01-02.
To download the file in PDF format append the viewer command option "__format=PDF" to the end of the URL.
So the end result will look like this:
localhost:8080/birt/run?_report=report1.rptdesign&StartDate=2011-01-01&EndDate=2011-01-02&_format=PDF
This will download the file in PDF format without any interactions to the actual BIRT runtime.
Hope this gives you some ideas anyways, I know it's not an optimal solution. But at least it's something.

How to find Bonjour in local wifi in Android

I have a problem that I want to get an Ip of remote computer via Bonjour which is preinstalled . But I unable to connect with that, I don't know why because I have download an example code from Git Hub and also download the jmdns3.4.1 Jar. But the sample contains the error as Conversion to Dalvik format failed with error 1. Then I have written this question to get the exact answer.
Thanks is advance.
First off you need to use a special version of jmdns compiled for Android found here. The reason is Android cannot actually execute Java class files, but rather executes Java dex files since it uses Dalvik.
It may also be a jar-conflict if you are 100% sure you're using the right jar-file. See this question for more information.

Categories

Resources