That is really happening. I made test in PHP to confirm this.
I created a test.php file and put:
<?php
error_log('Downloading...');
header('Content-type: application/force-download');
header('Content-Disposition: attachment; filename="test.txt"');
echo 'test android download';
?>
So, when I open www.myurl/test.php via any Android mobile browser, in the error_log.log I get "Downloading..." two times.
When i open same URL in any other Mobile OS(Windows, IOS, etc.) I get only one time "Downloading..." in error_log.log file.
Does anyone know what's going on and how to avoid this ??
This is a big problem for me, because I perform user charging when somebody download a file. And now from Android Phones there are 2 charges for 1 downloaded file.
I am in a dead end :(
http://code.google.com/p/android/issues/detail?id=1978
The browser needs to hit the server to determine that something is a download, and than the download manager has to separately contact the server for downloading.
So, Android fire up first request to open dialogue box for "are you sure? - yes/no".
And if user click "Yes" Android Forward request to Android DownloadManager and manager send second request to download file. (some Android version send request to DownloadManager immediately)
The problem is that both request, first and second, are type of GET (not HEAD).
In my case I receive two requests.
First one throws org.apache.catalina.connector.ClientAbortException with description java.net.SocketException: Connection reset by peer: socket
So I just catch that exception and write log.
I guess you can do the same and charge customers only after successful downloading
Related
I need to access the logfiles of an Virdi AC 7000 Fingerprint terminal. There exist 2 SDKs, the UCBioBSP SDK to communicate directly with the device and the UNION COMMUNITY Server SDK which probable only functions in combination with UNIS server (please correct me if I am wrong as the documentation was rather fuzzy on that detail). The UCBioBSP does not provide the functionality to download logs and my client does not want to use UNIS. Is there another way to download the logs from the terminal? As the UNIS server can access them there should be another way to download them (since it runs on android). Maybe ftp, web services or something else. Any advice is apreciated.
Thanks!
You need to use the VIRDI sample code(UCSAPI), provided in C#, C++ or VB.
When you "Start Server", It will open a Listening on port 9870.
The VIRDI AC7000 will connect with this server.
Then you send the command to get the logs, as you can see in the image below.
i want to have a URL like this one (https://www.ooklnet.com/files/381/381489/video.mp4) where when you click it and itll play the video. Thing is this isnt my website or video. i tried my URL which i thought was corrct (http://54.XXX.XXX.238/srv/ProductVideos/lazar108#hotmail.com/s/s_7s.MP4) and it gives me this error:
The requested URL /srv/ProductVideos/lazar108#hotmail.com/s/s_7s.MP4 was not found on this server.
I know for a fact that theres a video in the file path on my server. Proof:
(I need this URL for my android app so i can display the video in the app.)
How can i create a link like this one (https://www.ooklnet.com/files/381/381489/video.mp4)?
I have a Ubuntu 14.04.4 server with AWS EC2!
Any help would be appreciated!!
Thank you!
1) your EC2 has to have security groups open to allow any access to port 80 from the Internet
2) your EC2 has to be running some web server software such as apache
3) apache needs to be configured to serve files, check the document root
4) apache needs to be configured to correctly send mp4 with the right mime type headers see this answer Apache not serving .mp4 files correctly - shows the contents of the file rather than a download prompt
If it is apache ( and not nginx or another web server) you are using check the access log file /var/log/apache2/access.log and the default error log /var/log/apache2/error.log
So here it is, I'm starting a Phonegap app and would like to use a given library. In the library code it tries to reach some URL with this form :
//img.site.com/given_img.png
without http or https at the beginning so it will adapt nicely. But when launching the app on my phone I see it tries to reach :
file://img.site.com/given_img.png
Not http or https... But file protocol. Obviously it fails to load...
Anyone knows how to deal with this ?
Thanks ahead !
As far as I can tell, after researching this for some time... Currently there is no solution out of the box. You have to check the code with JS and force add the wanted protocol into it before execution. I simply changed the way I wanted to do things and avoided that kind of situation.
The idea behind having src="//domain.com/some/pic" is so that the browser will request those assets with the protocol matching your website, meaning, if your website is running on http - it will request the picture over http, vs if your website is running on https it will request the image with https://.
#Jeremy is right, there's no option at the moment.
But you can take the protocol matching your website with var protocol = window.location.protocol and use that in your src={{ protocol + image }}
This is to prevent from writing hard-coded http / https and mix secure with non-secure content in your website which causes errors to jump like "This Page Contains Both Secure and Non-Secure Items"
I'm trying to create an Android (2.2) app using Phonegap (version 1.9.0) and jQuery Mobile (1.1.0). Specifically, the app is supposed to send a GET request to an existing WCF REST service and retrieve JSON data (a list of folders) and display each item as an option in a select drop down menu.
Right now, all this works as it should when I use the desktop browser. The WCF REST service sends the correct response, the browser renders the page correctly and puts the options in the select menu as I want it to. However, when I use the following code in Android app using Phonegap:
$.getJSON('http://xxx.xxx.xxx/MobileService.svc/GetFolders?callback=?', null, function (folders) {
$.each( folders, function( i, folder ) {
$("#folders").append("<option value='"+folder.Id+"'>"+folder.Name+"</option>");
});
$("#folders").selectmenu("refresh");
});
...I get the error message when I boot the Android app (debugging on physical device):
Connection to the server was unsuccessful. ("file:///android_asset/www/index.html")
When I comment out the above $.getJSON code, the app loads fine, but the select menu is unpopulated.
I've also noticed that apparently because Phonegap uses the "file://" protocol, it is not affected by the "same-origin policy" that the "http://" protocol is...I had been using JSONP when I was working with the browser, which is why I have the callback. I don't think this should be the reason why it is failing, but I dont know. Any help will be greatly appreciated!
Things I've tried:
Changing the access origin to ".*" in the cordova.xml
Adding 'super.setIntegerProperty("loadUrlTimeoutValue", 60000);' to the activity
You can try to set your cordova.xml to "*" instead of ".*" as seen on the Getting Started Guide
Or even better:
http://xxx.xxx.xxx
It turns out in my particular case that the issue boiled down to the mobile phone being on guest wifi network that didn't have access to the network where the REST service was hosted so the connection was being blocked.
Hope that can help someone
I am new to rhomobile so let me begin.
I am able to view the device rho-log file on my android device. There is a few options when the window opens "Refresh,Clear,Send,Close".
Question 1. When I press send where does it get sent to?
Question 2. Is it possible to send it somewhere so I could download it as .txt file on a desktop and view it.
Thanks in advance.
In the rhoconfig.txt file of the root directory, there is a logserver property that points to a URL where the log will be posted to, logserver = 'http://yourloggerapp.heroku.com'
You can find the logging application to stand up on Heroku (quickly, but can be deployed anywhere) here. This application is set up to hook into an Amazon S3 server, but again, can be modified to store the log files anywhere.
You can set this variable at runtime:
Rho::RhoConfig.logserver = 'http://yourserver.com/logs'
Or this fixed parameter in rhoconfig.txt:
logserver = 'http://yourserver.com/logs
When the user press the "Send" button your server will receive a POST request in this URL:
http://yourserver.com/logs/client_log