Rhomobile send logfile - android

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

Related

How to implement email adapter for Parse to allow password reset feature

Problem description
I am using AWS EC2 to host my bitnami parse server which acts as the backend for my android app. I am having trouble implementing password reset for the users of my app. I have followed the instructions from:
https://github.com/parse-community/parse-server#email-verification-and-password-reset
But I still get the error:
"com.parse.ParseRequest$ParseRequestException: An appName, publicServerURL, and emailAdapter are required for password reset and email verification functionality."
Step by step of what I did
I went to mailgun and created an account.
I registered a domain that I own (hosted by squarespace) to mailgun. (see picture below)
I went to my server.js file located in the apps/parse/htdocs folder.
I modified my server.js file to look like this, shown below.
Then in my android application, I called a test password reset using the following code.
Things I am unsure of
I haven't physically installed anything such as the simple-mailgun-adapter. I tried to follow this link: https://github.com/parse-community/parse-server-simple-mailgun-adapter. and install
npm install --save #parse/simple-mailgun-adapter to my apps/parse/htdocs folder. But I got a whole bunch of errors. Shown below.
I'm not sure what the publicServerURL is in the server.js file. I assumed it is the same thing as serverURL, so if you look at my server.js file, both serverURL and publicServerURL have the same input.
Please let me know if you guys can spot any errors I made. I've been working on this for a week, and still can't get password recovery working. Thank you!
A few things:
If your package.json has
"parse-server-simple-mailgun-adapter":"1.0.0",
under the dependencies section, then the package should be installed automatically. I usually check under the node_modules folder.
The resetPassword error is saying you are missing the appName parameter. You need to add it to your server config object:
var config = {
...
publicServerURL: (process.env.SERVER_URL || 'http://localhost:1337') + mountPath,
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'YOURAPPNAME',
...
Your publicServerURL is usually something like server.domain.com. It helps since people resetting their password will be redirected to a webpage on the domain where they will enter a new password. It's nice for users if the domain reflects something they can trust...
Hope this helps.
add {} in your package.json as it should not be empty.

Download Google doc file to device

I am trying to download a doc.google file to my device, however I can't figure the best way for that..
First: I created an Auth key to my Drive following this tutorial
Then: I am trying to follow this tutorial to download the file, but It is not going well
I want to connect to this Auth key through the app and download/Export the file automatically without prompting the user to choose account or anything..
This is the URL for the doc file:
https://docs.google.com/spreadsheets/d/1QJTna4iz-VivwAzwgq7V5QDs2XbgM2lEFPEG7NqCPdo/
Thanks in advance
Try the method used in this SO post.
It was cited that to overcome the google problem when setting the file publicly. As in the post:
If you set the file permissions to be publicly available and
create/generate a direct access link by using something like the
gdocs2direct tool or just crafting the link yourself:
https://docs.google.com/uc?export=download&id=<your file id>
You will get a cookie based verification code and prompt "Google could
not scan this file" prompt, which won't work for things such as
wget or Vagrantfile configs.
The code that it generates is a simple code that appends GET query
variable ...&confirm=### to the string, but it's per user specific,
so it's not like you can copy/paste that query variable for others.
The specified web page hosting method will suffice.

Chrome Sender Sample App

I am trying to make an app for personal use that has the same functionality of the chrome sender sample app (https://github.com/googlecast/CastHelloText-chrome)
The only thing I am trying to change is the "SAMPLE APP" at the top of the casted screen. I have registered my device via the console and created a new custom receiver in this receiver i have included a URL for a Google drive HTML document I made (Just a black HTML page: https://www.googledrive.com/host/0B7IBRkdKpfYSRmZCYzJaTUpDamM
I then took my newly acquired application id and injected it into the code replacing the Googles sample app ID... I am using Mongoose to host the webpage locally and after I type a message I get no option to connect to my cast device.
Also I have entered my computers local IP and port number (where I am hosting the sender app) under sender details (chrome). I have tried Google's sample code and it works fine the only thing I have changed is the application ID.
Thanks!
I tried the same thing a week ago and the google drive's trick (to host an html page) doesn't work for me.
Your receiver app (your black html page) need to be accessible online, otherwise it's impossible to connect your sender app to your cast device.
So you must put your html file on a server. Do you have a personnal server to host it ?
I pushed your html file on my server and it's connected to a new App ID. Can you try with this App ID : E46DA3D7
If it's working then your probleme is really Google Drive hosting.
Let me know ;)

how do I open a newly written file from application storage directory in as3 / flex mobile?

Im working on an app (flex 4.12 sdk, using flashbuilder 4.5, creating an app for ios and android, testing on an android htc one primarily)... and am using the camera to capture a file... Im then saving that image to the application storage directory, and I want to open the image in the default web browser or trigger a native dialog (android users) to choose the web browser of their choice... how it opens isnt really important right now -- Im mainly trying to just 'access' it with the device and 'load' it outside my air app...
heres the code I have:
var fs2 : FileStream = new FileStream();
fs2.addEventListener(Event.CLOSE, fileCompleteHandler);
var targetFile : File = File.applicationStorageDirectory.resolvePath("test.jpg");
fs2.openAsync(targetFile, FileMode.WRITE);
fs2.writeBytes(myBMDByteArray,0,myBMDByteArray.length);
fs2.close();
and for the event listener that detects the close of the newly created file:
function fileCompleteHandler(e:Event):void {
trace('File saved.');
trace('exists? ' + targetFile.exists);
trace('the url: ' + targetFile.url);
trace('path: ' + targetFile.nativePath);
navigateToURL(new URLRequest(targetFile.url));
}
I get the following info back from this listener
File saved.
exists? true
the url: app-storage:/test.jpg
path: /data/data/air.com.xxxxx.apptesting.debug/com.xxxxx.apptesting.debug/Local Store/test.jpg
... and problem is that navigateToURL cant access the location where the file is stored (the protocol shows in browser as file:///data/data/air.com/xxx... )
how can I use navigateToURL to get access to this newly created file in the web browser or whatever native application the device associates with the file (its a .JPG file)? I also have had success in adding the newly created image to the camera roll but couldnt figure out how to then open that newly saved image in the native camera roll or whatever app the device chooses or presents to the user for the .jpg format.
I can show the user the image INSIDE my app by referencing the bitmap data fine, I just want to give the user access to the physical file that Im creating on their device.
I even have had success in posting (via urlLoader) the bitmap data as base64 encoding and then creating a file on the server side and loading that url but the encoding and trip to and from the server to give the user the image adds a lot of overhead and it takes a little too long and I'd like to avoid that elongated process.
Thanks for any help anyone can provide - let me know if I need to be more specific in any of this.
Solved the issue... I was able to store / write my file in the documentsDirectory using:
var targetFile : File = File.documentsDirectory.resolvePath('test.jpg');
and then
navigateToURL(new URLRequest(targetFile.url));
And this works fine now. Hopefully it helps someone else! Seems that the storage directory SHOULD work but up until now I've only written to and read files stored there... maybe to open the files one HAS to copy it to a 'safe' location in the filesystem (i.e. sd card?)... will move on to test in ios Now - hope all works well in that OS. Thanks all who chimed in on this.
My first hunch is that you need to specify the proper user-permissions in your application descriptor so you can use the openWith functionality with content from your application.
Remember that you need to specify this for IOS and Android specifically.
On your application.xml you need this permissions set inside android > manifestAdditions > manifest:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
With this permissions you can save files to applicationStorageDirectory:
const FILE_LOADER:URLLoader = new URLLoader();
FILE_LOADER.addEventListener(Event.COMPLETE, onTempFileComplete);
FILE_LOADER.dataFormat = URLLoaderDataFormat.BINARY;
FILE_LOADER.load(new URLRequest(BASE_URL + filePath));
The applicationStorageDirectory can only be accessed by the application it belongs too when using Android or iOS. navigateToURL() hands over your request to the default browser, which cannot access said directory.
documentsDirectory is a public directory in Android, but not in iOS. So it cannot be used for both platforms. Unfortunately none of the pre-compiled file paths File has point to a public directory in iOS. You can find a table explaining all the pre-compiled paths here

Android is sending 2 requests to download one file via mobile browser

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

Categories

Resources