Panasonic API for Firefox OS Apps - firefox-os

Thanks to MDN I successfully deployed a simple app on my Panasonic CXW754. So far so good. Now I'd like to have access to screen settings like brightness etc. Is there an API provided by Panasonic or can I do it with plain Firefox OS API somehow?
I already looked at https://github.com/mozilla-b2g/gaia/tree/master/tv_apps
But navigator.mozSettings is null and navigator.tv does not exist on my TV runtime :(

You should be able to change screen brightness using navigator.mozPower.screenBrightness from the PowerManager API. Only certified apps can access this API though.

I would use the SettingsManager API instead of using directly navigator.mozPower.screenBrightness.
The SettingsManager let you change almost any setting by firstly requesting and locking that setting. It can even let you add Observers:
https://developer.mozilla.org/en-US/docs/Web/API/SettingsManager
For example: https://github.com/shawnjohnjr/releases-mozilla-central/blob/8355c4efc146c9e58f7d11cdb5f567908b5754c0/toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.js
But as pointed out by #kumar303, it is only for certified apps.

Related

Integrating Optimizely with Adobe Analytics

I'm trying to Integrating Optimizely with Adobe Analytics. I have followed along with this guide: https://help.optimizely.com/Integrate_Other_Platforms/Integrating_Optimizely_with_Adobe_Analytics with no success.
The props(prop51) and evars(eVar51) that i'm choosing via the experiment integrations in Optimizely are never sent. I check via the wasp chrome add-on and via the Adobe account.
All other data (props & eVars) that we set manually are sent.
We are not using s_code.js but AppMeasurement.js version: 1.5.1. I don't know if we are using custom s variable. I guess not. So I have follow the guide and used:
window.optimizely.push("activateSiteCatalyst"); with no success.
I have also tried: window.optimizely.push(['activateSiteCatalyst', {"sVariable": s_c_il[0].account)}]); where s_c_il[0].account holds the account name, but with no success.
Tried following this guid as well: http://digitalinsightsworld.com/tag-manager/dtm/optimizely-implementation-check-list-adobe-sitecatalyst/
Does anyone have an idea of what is wrong? Or how to go forward?
Br,
Johan
I had the same problem... We're using AngularJS 1.4.x. The default value for sVariable is 's'. Generally stated, Optimizely expects window.s to be the omniture object. Angular abstracts this object to its own injectable item, and is therefore not a standard DOM/element off window. My quick hack was to set window.s = s from within the Omniture directive. I'm still working out the best location to do this assignment, but I can verify that I now see the custom eVar for Optimizely outgoing in our Omniture call (using Omnibug). Hope this helps!

How does webkitSpeechRecognition() work without an API key?

Every reverse engineering of the Google Speech API requires an API key but Chrome is able to call the server, seemingly without one. How does this work internally?
Is it possible to use the API for any sort of large scale speech transcription?
Looking into the Chromium source code, http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/speech/google_one_shot_remote_engine.cc indicates that the server is passed an API key with the request.
It also seems that Google Chrome comes with an API key, and chromium can, depending on the distribution. https://code.google.com/p/chromium/wiki/ChromiumBrowserVsGoogleChrome
It's still unclear to me why the browser calls to the server are not effected by the 50 calls/day limit.

Native Client use outside of the Chrome App Store

I have successfully created a Native Client app that works using localhost and works once posted to the Chrome App Store.
I now need to find a way to embed this app in a web page outside of the App Store, which currently fails.
I've read that the usage of the nacl_io and specifically sockets is ONLY accessible when published via the Chrome App Store?
I also came across this https://developer.chrome.com/extensions/apps (I know it's essentially discontinued). Is there a replacement that could work? Or is it just the Chrome App Store?
The <embed> tag is mentioned here (https://developer.chrome.com/native-client/devguide/coding/application-structure). Am I right in saying even if we got this to load the .hmf file and communicate with the .pexe that it would still fail when using sockets due to the application not being passed through the Chrome App Store?
Any advice is welcome
Socket access is only allowed for applications in the Chrome Web Store. Similarly, Native Client applications (e.g. using a .nexe file) are also only allowed on the Chrome Web Store.
You can run a Portable Native Client (PNaCl) application on the open web, but it will not have access to the socket API.
nacl_io is still available to use. It's only the socket API that will fail if you try to use it.
You can still use the URLLoader and WebSocket APIs, though. Perhaps these will be enough for your application?

How to work with Camera API in Firefox OS

I want to work with camera api in firefox os simulator. Docs suggests that it is only available for certified apps. If i want to take picture using camera in my app, how can i proceed developing the app?? Thanks in advance
You have to use the Web Activities API to take pictures. Simply put, it's the equivalent of Android's Intents for the Open Web.
I'd write a lot about it, but there are good code examples out there, like this one, implementing just that. You have to a few stuff:
Create a Web Activity:
var recordActivity = new MozActivity({ name: "record" });
Set a onsuccess callback, and do whatever you want with the result on it:
recordActivity.onsuccess = function () { console.log(this); }
There are a few more details, and all of them are listed on this post on Hacks.
So some stuff changed in the past year. Web Activities are still the way to go for most apps, but we have two APIs that were previously not exposed.
From Firefox OS 1.4 you have access to getUserMedia so you can get a direct camera stream. From Firefox OS 2.0 you now have access to the mozCameras API that allows for stuff like camera switching and control of the flash.

How to know the browser the user is using?

We have started developing an application for location aware emergency service. The users can connect through computer,smart phone or even through WAP. We want to use cloud servers (GAE or AWS). We want to optimize the site for the user's device.
I can not find out exactly how to know the device or the browser the user is using. From apache, by analyzing browser request, we could know the browser type. But how to learn that in Cloud servers like GAE or AWS? Is there any other way to learn which browser or device the user is using? Also is it possible to know the ip address of the user in GAE or AWS?
Thanks in advance.
I have no experience with programming in the cloud, but the request headers (among them USER_AGENT) come from the client and should be present as usual.
For GAE / Python, the answer is in this question: User-Agent in Google App Engine python
For GAE / Java, a hint is in the GAE docs. There must be a request object containing all the headers.

Resources