Inline:
On Sunday, November 29, 2015 at 5:15:45 PM UTC-6, Brett Reed wrote:
Hello, I've used multiple app development methods and last night I found PhoneGap and it seems to be exactly what I've been looking for. But there's some concerns I have that I can't seem to find answers to. Maybe I'm not looking hard enough, but I figured I could post here, maybe someone could point me in the right direction.
When an app is compiled, built and ready to run on a device, are the assets and /www/ folder accessible and hidden within the app itself?
App assets, both native and hybrid, are available on the device. Your www folder is also available and human-readable. You could encrypt the contents, but that's more trouble than it is worth (IMO) and you'd have to store that encryption key somewhere, which means a user is probably going to be able to figure it out anyway. In short: store no secrets in your local code!
[Side note: Native apps don't escape this either. I can read the assembly code for any native app I want. It's not as easy as reading JavaScript, obviously, but it's still possible.]
If it is, how would I go about using server side scripting? Like PHP and mySQL. Is that even possible? Do I need to figure out how to store information on an html page rather than being sent to a server?
Server side scripting is for the server, so you'll need the following setup:
local code: HTML, JS, CSS using XHR/Sockets to communicate to your external server. Be sure to cache so that your app is usable offlline (if that makes sense for your app)
webserver: PHP webservice accepting (and verifying) requests from your app's local code. Queries your MySQL database and returns appropriate results. Don't forget about SSL encryption! [and don't use self-signed certificates!]
database server: mySQL backend. It's also possible that you might want SQLite on the local side for easy caching and such (there are third-party plugins for this), but you'll have to write sync/cache code yourself.
Your local code will be a single page web app. Single page is a misnomer, but it boils down to this: the app will only ever navigate to "index.html", and from there the contents of your DOM are managed by JavaScript (and are usually dynamic). You have access to local storage options (localStorage, IndexedDB, Web SQL via plugin, File API) and the network, but no access to other databases except via a webservice.
Or are the files stored over the internet and called upon when the app is run?
You can do this, but you should maintain a local copy in case the app is offline. Apple will require that your app does something sensible when offline, even if only to generate a human-readable error.
Personally, my code is always stored locally, and my updates go through the normal process via the app stores. Others do differently and get by OK.
One thing you must be aware of, however, is that your app can't simply wrap an external website. Apple WILL reject your app. Make sure it uses at least some of the native capabilities of the device and you'll be fine.
Or does the app act as a server?
For example of an app:
An app like instagram, I would need the app to access a server for storing of images, and for user log-ins/registration.
Instagram's not trivial, and if you intend on creating the full stack, it's going to be quite the project. Might I suggest using a Backend-as-a-Service instead, like Parse? This way you don't have to worry about the database and backend security, and they have very easy-to-use SDKs for communication between the backend and client. In short, your images and user credentials would be sitting over at Parse, and you'd make simple SDK calls to retrieve data and upload new data.
Otherwise, you'll need something like I mentioned above (at least): a webservice that acts as an intermediary between your client and the database server and that properly validates incoming data, and a database server. Security on this is going to be a pain in the rear, especially since you are dealing with user credentials.
Also I hear a lot of reference to GitHub and Node.js. I'm really not sure what they're for.
Git is a code versioning system. GitHub is just one of many sites that host code repositories and enable social aspects (like forking, issues, wikis, etc.) You'll want to familiarize yourself with Git immediately -- although you don't have to know much about it, you should know how to version your code, and it will eventually save your ass down the line when you completely mess things up. I've been there, done that, and having Git versioning everything is wonderful.
[Note: If you version your code using another versioning system, that's fine. Just make sure you do it somehow.]
Note.js is a way to run JavaScript outside of the browser. It's used in server-side code much like PHP is. It also makes an ideal environment for creating cross-platform command-line utilities, which is why Cordova/PhoneGap CLI uses it.
I have the PhoneGap standalone local server program for windows. And it seems to do what I need it to do. Besides compiling I haven't figured that out, but that's a later issue.
If you're only ever going to upload to PhoneGap Build, this is all you absolutely need. If you ever intend on compiling locally, you'll need to install Node.js and the Cordova/Phonegap CLI (and appropriate SDKs).
Any help? Thanks!
Side note: you mention Windows -- if you intend on developing for iOS, you're going to need to get access to a Mac at some point! You can buy a Mac Mini or rent one in the cloud or just find a friend with one. Just something to think of.
Hope that helps!