Cordova - Track when apps open and move to background - android

I'm doing a research project looking at app usage, habitual use and addition. I'm programming an app using HTML5, CSS3, and jQuery and need a Cordova plugin that can identify when other apps are being used (i.e. open an app, move to the background, foreground, close an app). All this app needs to do is track how much users open apps and how long they use them.
We will recruit users to willingly participate in this study and only inform our research participants about the data we are tracking and how it's being used.
I know that the app I'm working on needs to be open and running in the background to be able to collect this data and I've already found Cordova plugins to prevent the app from going to sleep. I'm also considering battery usage as well.
There are parental monitoring apps that do this already and collect way more data that we need so I know it's possible. If anybody can point me in the right direction and help I would greatly appreciate it!

Related

Web App vs iOS App - Geo Location Considerations

I am working on developing my first app. Essentially, I am trying to create a roadmap at this point and I am having difficulty figuring out what path is the best. I need users to be able to login with either their gmail account or their facebook account. Once they log in, I need permission to access their location, pictures, name, age and interests (facebook).
Would it be wiser to develop this app for iOS and Android separately or because it is a web app, I can make it compatible with both android and iOS devices and develop it with something like jquery mobile? The location part of the application is key. I was planning on using HTML5/JavaScript Geo to look up the users current location. Will this suffice? Or do most applications use the native OS geo location tools?
Essentially the end goal is to develop a downloadable app for both iOS and Android. Which asks the users for permissions to access their friends list, location services, name, age etc. Once access is given, the user stays logged in until they manually log out. I appreciate any guidance in this regard. I am trying to avoid spending a lot of time on developing a big project on the wrong path and I appreciate any suggestions.
Thanks in advance
The answer, of course, is it depends. HTML5 geolocation works fine if you just need the location. If you want to track someone accurately (for example a running app or a driving app) and need frequent updates then you want native. If you want your location updates to function when the app is minimized then you want native. Also, HTML5 may not work on older phones and older browsers, whereas native is guaranteed to work if they are able to open your app. But at this point, most phones will work fine.
Your third option is to split the difference if you don't want to build/support multiple native apps (or don't want to learn multiple languages). There are plenty of frameworks (e.g. PhoneGap, Cordova, etc) to allow you to build native apps (which access native geolocation) using web technologies like HTML5 and Javascript which function on all (major) OS platforms.

Suggestion: Native or Web App depending upon my idea?

What I want to develop: Crude Overview?
Suppose 10 web links present on my (native/web) app, and user will scroll through links. And when user clicks on any of the link, it will open that website. And user might wish to close this website and again views the list of those URLs on my app and the cycle may go on as per his wish. Also, user can create custom list of those links. Also, these lists will be updated regularly, may be on monthly basis. Which I guess I just need to update data files and not app.
No, it is not similar to browser bookmarks but in very crude terms you can relate it. Anyways, I will accessing user's bookmarks with his permission which I guess can be easily done with the APIs available.
Right now, technologies in my mind.
1) Phonegap ( to be precise, its phonegap build - as I don't have MAC) with JQuery mobile and deploy as native app,or
2) SenchaTouch and deploy as web app or native app using sencha cmd.
3) I want to use MongoDB along with above 1st or 2nd option. Is it required or JSON can suffice? Also, I may need some security by encrypting this data while storage at user's mobile and also while collecting user's custom lists.
4) In future, I would also need Node.js for the purpose of collecting MongoDB or JSON data files in above 3rd point. Is there any other way so that it can be integrated with phonegap or senchaTouch.
Please suggest things if existing resources can help me develop my idea and guide me what to use!
Note: All technologies I am picking up are focused on single code base with minimal focus on platform specific changes-iOS/android/Windows/Blackberry.
I want to go for Native app rather than web app. Why?
1) I feel that it would perform faster if I deploy my idea as android/iOS/Windows app rather than web application.
2) My cost of hosting the application on server will go to null because I am using local storage of the user's mobile.
3) Since I want a feature in my app which stores user custom settings so it would be better if I deploy it as mobile app rather than web app so that I don't have to maintain user specific settings which may make my DataBase hosted on server to grow immense in future.
4) Also,I feel that there is no sense in hosting this application on a dedicated server because there would be less user interaction with my backend. But later I would plan a feature to collect data/settings done by user to improve feed for which I think I need to use Node.js. But then also there is no requirement of hosting frontend to a dedicated server. Hence, I can use dedicated server to serve my own purpose of analytics to improve feed rather than service user's purpose of unnecessary access to my web application always through the server and fetching lists of links which are maintained on server in custom manner for him.
My dilemma!
My above points are valid to prefer deploying as native app over rather than web app. But I feel what if I keep my app as offline web app which runs on the default browser of the user but loads the jquery and other data and scripts from the storage in mobile. Is this possible? I am unaware of this.
If this is available then it is the best thing for me to adopt as my application redirects to other websites. Because, if I am deploying my app as native app then it would ruin user experience of opening my app and selecting an option whose URL opens up in default user's mobile browser which is a different app and then there are many chances that user will switch back to my app and then again he would be redirected to that mobile browser. And obviously I cannot develop my own browser in my app as I would have to develop several things from security and other perspective which would be a cumbersome task. So, having my offline web app will be opened in user's default browser itself without annoying him to switch back and forth between my app and browser as in previous case and thus creating seamless experience.
Also, I am not sure whether we can create offline inbuilt browser plugins as we can do in chrome browser on desktop. If so, then I think I would have to concentrate differently on different mobile browsers Safari, Chrome, mozilla which I feel is not worthy. Please throw some light on this for me.
I have no idea why people are downvoting my question as I feel that it is kind of unique question.
Here is what I found more and with the help of my friend
1) I don't have to use MongoDB as my application is not much complex. So simple JSON will suffice.
2) I'll be using Phonegap for android and windows phone and phonegap build for iOS along with jQMobile. So the app will be in the native form only.
3) I'll be using inApp browser for seamless experience although it is not as perfect as having my idea as web app.
4) No need for senchaTouch as it is heavier than phonegap and not required for me idea.
5) My next look forward is comparing the above points with offline web app built using JQMobile and JSON and finally whatever I decide I will share.
EDIT:
I am finally going with phonegap for native deploy rather than offline web app or web app hosted on server for reasons that I found on several blogs.
People downvoted my ques so I feel that it is not worth writing answer further but if you want the detailed reason you can always add a comment.
Thank you
You should definitely go for web. It is cross platform. If you do an android App, or iOS App, they are restricted to the specific devices. So I definitely recommend Web App

Building Mobile Apps out of HTML5, with motion tracking?

This is an open question and I was really hoping for advice...
I am planning on creating a mobile app which will track your steps and distance (based on GPS), while sitting in your pocket.
I was planning to make the app out of html5 as I know you can calcualte the motion of the device using this
So, I am really asking if people think this is possible on HTML5?
Thanks
Assuming you know JavaScript, you should be able to accomplish this with PhoneGap's Geolocation object.
Appcelerator has Titanium.Geolocation as well.
If you plan to do it with HTML5 and PhoneGap is probably your best option. But you'll still need to program a background service* in order to handle tracking the location while the app isn't actively in use.
It sounds like the real work will need to be done in Java either way so I think you should just make a regular Android application. But as I said PhoneGap is still an option for the interface if that's what you really want.
* The background service will still need to be done with Android API's. Which would then need to be hooked into PhoneGap. It might just be simpler to make a native app.

What can't you do with an HTML5/Javascript mobile app that you can do with a native mobile app?

I have just started researching creating mobile apps and from what I understand one big advantage of using HTML5/Javascript is that you can write one application that works with both Android and iOS.
I have also read that one of the drawbacks is that there are certain things that you can't do with HTML5/Javascript that you can with a native mobile app.
Is what I stated above correct? What will I not be able to do if I decide to go the HTML5/Javascript route?
While both native and web have their own positives and negatives, the one main advantage that native apps had over web apps was "Offline Access"
However that is now changing as HTML5 has support fo Offline Web Applications.
Some things for iOS:
Background audio/sound effects
Address book
Leverage CoreGraphics & OpenGL for advanced drawing
Camera access
Accelerometer
Limited Calendar Access
It all depends on what you are going to do. If your app needs GPS, the accelerometer, or is very graphics intensive, then a native app is the only way to go.
Otherwise, I would go with something like Sencha Touch for your app for a couple reasons. First off, if you release an update with a HTML5 app, you don't need to force everyone to download it, it will update automatically. Also, as you mentioned, you only need to write one application for all mobile platforms, which expands the potential user base. Lastly, I think the internet on phones is getting fast enough to support internet applications very well, and this is only going to improve in the days to come.
Basically, it all depends on the specific needs of the application. Personally, I would go with HTML5 whenever possible, due to the mobility it gives you with platforms.
I think we can separate this into two lists...
What can be done on a mobile device that is not possible in HTML5:
Push Notifications
Advanced Graphics (3d, OpenGL)
File Uploads (possible on Android but not iOS)
Connect to Address Book
Connect to Calendar
What can be done in HTML5 but is easier or implemented better on mobile devices:
Camera Access
Offline Use
Device Location Services
Sound
Accelerometer
Speed / Slickness of UI (hard to quantify, but apps typically still feel nicer when native)
(Please note the date this was answered on, this landscape could be quite different in 6-12 months or more.)
In theory not much, if you use titanium. http://www.appcelerator.com/products/titanium-mobile-application-development/
Unlimited Extensibility
Titanium’s plug-in architecture allows you code modules in Objective-C or Java to
extend your mobile app with custom native functionality and then call those
modules using Javascript in Titanium.
Though i have never used Titanium and dont know how well this works. I would stick with native development anyhow ... for now.

Factors to consider to choose among client-side application or web application

It seems that there are 2 choices to develop a solution for Android platform : client-side application and web application.
According to http://developer.android.com/guide/webapps/index.html
The approach you choose for your
application could depend on several
factors...
But the tutorial doesn't mention what factors I should consider. May I know what is the factors I need to consider? Or in another word, what is the pros and cons of each solution?
p/s : When I talk about web application, I also mean the solution provided by http://www.phonegap.com/ as well. Seems that they able to pack HTML, JavaScript and CSS into a single package which looks like native app. (I haven't try that out)
Go native if...
You need capabilities that cannot be achieved such as the accelerometer
You need to run processes in the background, such as polling servers for updates, downloading information in the background, listening for changes made on the device
You need to know the orientation of the device, such as locking the user into only portrait or landscape or if you need to be alerted when this changes
You need to access system services such as sound manager
It's important to you to have a launcher icon
You need to do high performance stuff quickly (image editing, playing preloaded sounds, etc)
You need absolute control of your caching strategies for performance reasons. For example, if you need to download information from the web or preload a lot of images, you want control over this so that the browser doesn't flush this stuff without your control and then you have to make the user wait for things to download again and again
(via Greg's comment) You want your app to work while offline
Go web app if...
Your requirements are light and you want to get something up quickly that can be cross platform compatible (same app running on iPhone, etc)
(via Greg's comment) You don't mind that your app will always require an active network connection (will not work on the subway!)
Well the biggest is that if you build a web application, you open up your client base to the entire web, and not just someone who has an android phone.

Categories

Resources