how to connect android to node.js file on server - android

I've searched and tried everything I've found but nothing seems to work. I can't begin to show what I've tried as there are too many different approaches.
I want to create an android app, which runs on company server, using node.js. I've found a tutorial on how to use html and JavaScript on the app, but I don't want it doing the work on the client side.
What I'm trying to do is have perhaps the html on the app to simply connect to a .js file on the server which will in turn call the files for the different actions/events. At the moment it's simply to return a field from the database which I can do in the .js file itself, I just can't get android to connect to it.
Can someone tell me the most straight forward way to approach this?
I'm a newbie to android so I'm trying to use node as I'm comfortable with it.

Related

Set up a database server that takes http requests

Sorry for the basic question, but I can't find a way to word it properly to find what I need.
I'm making an Android application and I would like to make an SQL server database that I would put online (no localhost) to allow http requests to it, from my app. I want it online for academic purposes (no SQLite) but also to allow for multiple platforms.
Preferably, I would use a C# approach for the server so that I can use EntityFramework, but I don't know if it's a good way and I don't know how to put it online.
Thank you for your help.

Webview app code security

I have an app which runs mostly in webview and opens an html file from my server and most of the logic happens in its javascript files. If you open the html file on your browser you will have all the code with a simple inspect element. I wanted to ask how can I secure my application and prevent my code from being seen and copied.
Thanks
By default WebView doesn't allow debugging of its contents (unlike Chrome), unless it runs on a debug build of Android. Thus if you don't reveal the URL anywhere, users will simply not know what to open in a browser.
You can also minify/obfuscate your JavaScript code to make it barely readable, even if anyone somehow opens it. This also has a benefit of reducing download size.
A radical approach would be to generate all the results on the server and send them to clients. This way, your clients will not have any code at all on them. But this will greatly complicate any attempts to make the results interactive.

Android WebView: offline manifest vs local files

I'm developing a simple Android App where the user must fill in a very complex form, for which I believe it's much easier to use an HTML form than an Android Activity with tons of TextViews.
The data collected by the form must be sent to some remote database, and the application must be able to work offline.
I thought of two alternatives, the question is: which one would be better?
Let a WebView load a remote website with an offline manifest
Let a WebView load a local website in assets folder
My second question is related to the storage when offline, and once again I have two options, and I don't know which one is better:
Using the HTML5 local storage, and let HTML + javascript send data to the server when online again
Let my Android app catch the form data, and handle everything the Android way.
Any input will be very helpful. Thanks in advance.
Regarding the first question: depends on how often will you need to update your form. An online cached form can be updated quickly, while bundled pages are only updateable together with the app, and you will need to consider that both legacy and new clients can connect to your server at the same time (users will procrastinate updating).
Another aspect is portability. Do you envision an iOS version of your app, or perhaps a mobile site? If yes, then an HTML5 solution is definitely more portable. Also, debugging an app which is entirely HTML or entirely native is usually easier than a hybrid one -- you can stay within a single debugger.
Perhaps, one drawback of using HTML local storage inside WebView is that the data you save will be in a kind of a "black box" -- you will not be able to back it up easily.
[Added later] OK -- one drawback of putting your site into assets folder is that you'll have to use file: scheme in order to access it. This can lead to some cross-origin loading access related issues if you will try to mix your bundled content with content from the web. Check these WebView settings for example: setAllowFileAccessFromFileURLs, setAllowUniversalAccessFromFileURLs, setMixedContentMode.

Android App to talk to a web server, download a file and parse

I am new to this. I have the Android SDK installed with Eclipse. I can work with basic activities and layouts.
I am looking to write this Android application that will;
1) Allow users to sign-in using a pre-allocated password.
2) Login and change the password.
3) Every time the user opens the app, he downloads a CSV file from a server to the SD card.
4) The app parses from the file and displays them on several activities and small frames inside the app.
Think of it as an informational application. But, I'd like to add some intelligence on top of it after I get this done.
I have read many articles and topics but none of them give me a specific approach to do this faster. I have very little time for development.
If there's a similar application that you're familiar with, I'd like to take a look at the code.
I want to know exactly (the code) on how the communication between the app and a linux based server on the web needs to be established. Right now, there's only a CSV file (or an EXCEL file - which one's better to parse? How to decide?) there.
Also, when the CSV file is up to date, I wouldn't want it to download the file again. How to prevent it?
As I said, I am new - so please be patient.
Thanks
If you are new to this and want to develop something fast, why do it the hardest way, in java? There are so many easy toolkits out there, e.g. RFO.Basic, you will be amazed how much you can achieve, fast, that way.
(You asked several questions) Easiest to parse? If you don't have Excel installed on your Android device, the CSV is of course easier to parse, needing only text tools. However, if you have a choice of formats, why not use XML? If you have never worked with XML, there is a little learning curve, but there are lots of tutorials on the web. After that, you'll never want to go back to CSV.
Your last question: how to prevent download of unchanged file? Is this about a big file? In that case start with quickly downloading the hash (checksum) of the file, so that the client can decide if the file has changed.

modifying HTML through an android application

This may seam like a simple question, but it has been stumping me for quite a while.
Is there anyway to modify variables in an HTML code, or the HTML code itself, through an android application connected to the internet?
For example if I have a website http://count.com can I make a android application with one button which, when clicked, increments the count on the website (http://count.com).
The HTML code on the website could be a variable which is then incremented, or simple a number which is found an incremented.
I understand how to read HTML code from a website on an android application, but not how to (or if its possible to) write it.
If it is not possible if you could suggest an alternative I would be very grateful.
you can modify the HelloWord.html in your Android or in Desktop ( Android connects to Desktop via teamviewer). Save and FTP to the web hosting and is done.
The problem it is: if you didn't know this, you will not know how to do it even if I told.

Categories

Resources