When porting a chrome packaged app to a firefox packaged app you will need to do an inventory as to which chrome specific api’s you are using and create a level of abstraction around them, as the naming / capabilities of the apis vary across the platforms.
I will try to break this article into information on which apis are supported across both platforms, where you can find docs, and lastly which apis have no commonality across both platforms (Firefox or Chrome).
Web APIs in Common:
The Web APIs that share commonality in function between the two platforms, are listed below:
alarm, getUserMedia(audio), Bluetooth, Device Storage API, navigator.id API, Idle API, Geolocation API, Web Notifications, Permissions API, Battery Status API, Simple Push API, TCP Socket API, Pointer Lock API, Power Management API, ContextMenus
List of Chrome’s HTML5 apis: http://developer.chrome.com/apps/api_other.html
The difficulty for the developer will be in writing an app that can handle both browsers elegantly. This is already done in many cases with the use of W3C compliant API’s such as geolocation data.(navigator.geolocation, which is also supported under google chrome, just not listed as such in their packaged apps documentation (ack), and soon to be battery status. But for the majority the function calls are different as well as the data being returned.
The other part of the discussion could revolve around which Firefox OS API’s are not yet implemented in Chrome OS. How close are all the APIs to standardization ?
Chrome OS similarly has a set of APIs which are not implemented in Firefox OS:
app.window = a concept not supported in firefox, generally gives the ability to maximize, minimize, change window size..etc
app.runtime = a concept not supported in firefox, basically used to notify when the app has been restarted
i18n = internationalization API.
serial= An API that allows you to read contents of the serial port.
runtime = API to retrieve the background page, return details about the manifest, and listen for and respond to events in the app or extension lifecycle.
tts: Text To Speech API
usb: An API that allows you to access USB based devices
So I thought I’d spend a few moments writing about why I am not too interested in a social phone, and basically just bitch and whine about why I am not too happy about having all my phone interactions to be viewed through the lens of facebook.
There are probably 5-10 people I call on a regular basis, I don’t think i’d call more people if my phone was more social, would I post more to facebook ? Would I upload more photos ? Probably not…
Where is the value add for the consumer, I sometimes wonder if companies invent ideas to satisfy there need to do something rather than satisfy a need in the market. My most pressing concern with facebook at this point is that the software is slow. I can’t really go into why it is slow, because the code is not open sourced. But compared to Google+ it is molasses.
I very well don’t want something that is slow / buggy to take over my homescreen. I dislike this concept immensely. (Given that my phone was released approx 2 years ago)
A new idea:
The problem I have with my phone is around the following list. List is not ordered according to any priority.
- Privacy: I don’t know what most apps are doing. As a user you have no clue when an app is gathering data, and when it is being disseminated. I don’t think giving an app blanket permissions for geolocation access is enough, I generally want to know what data it is using and when. I want to be able to analyze this data. (Tough problem to solve)
- Data Segregation: I would like data segregation to happen further up in the app ecosystem so data is stored in an app independent datastore. Apps should share not just activities, but data. Ex: After my run, I would have a copy of the geolocation information on my phone, and have it setup to share that information with Strava / mapmyrun..etc..etc. What I don’t want is for a specific app to gather information, and then surreptitiously pass that information up to their service, and all of a sudden I dont have a copy of my own data. (Tough problem to solve)
- Async: All apps should by default not block. I think spinning wheel = annoying, if the internet is not accessible, highlight that on the device, if there is a queue of events that need to be processed, and something is blocking then highlight that, an let the user make the appropriate choice. (Tough problem to solve)
I really dislike that there is this idea being pushed that for the user having a social phone is a good thing ? When for me it doesn’t solve any of the problems that I actually care about. If my friend is listening to Rhianna on his lunch break, which although interesting and confusing (why would any guy be listening to Rhianna on their lunch break), it unfortunately has a lower priority on my list.
Solving any one of the above problems and then blanketing my phone with navy blue facebook colors is more acceptable, but just giving up all your data without getting anything in return..
That is just silly.
Gathering profiling Data on Firefox OS can be done in several different ways.
#1) Simpler is better, sometimes a stop watch is a great medium with which to gather timing data for an application you don’t understand.
2) In Application Profiling
var d = new Date();
console.log(“The time since epoch = ” + d.getTime());
Once you insert a few of these statements in “strategically” placed points.
Just cd gaia; make install-gaia, this will install the new version of gaia to your phone, and you can see what code path gets triggered at which points.
3)Measuring app startup Times
Turn on show app load times by loading your settings app.
Click Device Information –> More Information –> Developer –> Show Time to Load.
This is one mechanism for measuring app start times, but this only measure time until mozbrowserfirstpaint which measure the time until first pixels are available for an app.
More details can be found in Bug: 787378
I have my B2G device in hand….. how do I start gathering memory statistics for the apps I use.
Firstly git clone the b2g repo >
git clone https://github.com/mozilla-b2g/B2G
cd B2G /tools
python get_about_memory.py –help
There are several options you might want to consider with the tool, for now you can just run without any options.
Next Open Firefox Aurora or Nightly, and type about:memory. At the bottom of the page is a button for loading the memory report from File.
Select and open the file you just saved in B2G/tools/about-memory
As we progress through the webapps project there is an astounding see of change coming to HTML5 Apps near you.
If you are starting a new project, I would recommend that you think about some of the ideas I am laying out below.
Apps will have different characteristics than webapps. You generally will not just want to layer css ontop of your page, and consider it mobile enabled and done.
You will have to design a completely different set of views for your mobile app than your desktop site, and possibly even your tablet as each platform will offer different capabilities that you’ll want to take advantage off. Your layouts will accomodate different styles, and furthermore different functionality.
Redirects: Another thing to consider is that an App doesn’t allow navigation off of the page, so you should think about that and what it means for your app. You wouldn’t want to redirect your users off of your domain.
Apps should be targeted / focused towards doing one thing well, and bubbling that information up to the user.
Popups: These are a web browser concept, that doesn’t translate into the App experience, so expect that popups won’t work.
So if you want a kick ass App experience, plan on having completely different views for different device sizes. The good news is everyone will be writing the same language, and basically using the same stylesheets !
There must be a ton of user UI tips, for writing kick ass mobile /tablet apps, if you have any add it to the conversation
So far I haven’t seen too much change in this area, the cloud is pretty much a given at this point, at least for a startup.
The time for the Android / IoS developer is over, don’t do it, don’t fragment your infrastructure, your support, your ability to ship early and often.. It’s just not worth it. If you are a startup and anyone is telling you to go native, i would seriously get second / third opinions.
Having said that using Phonegap or something of the like is a good idea to help bridge some of the functionality gaps.
The advantage of being small is that you can move quickly. Try doing that with an android release , iphone release, and website release.. All with differing capabilities / code bases, and then dealing with android fragmentation. It will make you slow, and slow is bad….