Can I install an app as certified on my own phone? (Firefox OS) - security

Is there any way that I can develop an app for Firefox OS that uses a certified API and install it on my own phone?
Our specific need is for telephony data such as signal strength. We can do this on Android without any difficulty (indeed, we could put the app on Google Play if we wanted to). But we just need to install it on a small number of in-house phones.
It seems that Firefox OS considers it to be in some way a security risk to find out the signal strength of the cell tower, and similar telephony data. Am I correct in assuming that there is no way that Firefox OS will let a developer app read this data?

If you are using Firefox OS 1.2 > you should be able to push a certified app to a unlocked phone for testing purposes. I put in code like:
testconn.onclick = function () {
var cnx = navigator.mozMobileConnection;
if (cnx.voice.connected) {
console.log("The signal has a strength of " + (+cnx.voice.relSignalStrength) + "%");
} else {
console.log("The state of the connection is: " + cnx.voice.state);
}
};
and entered the following permission in the manifest:
"permissions": {
"mobileconnection":{}
},
"type": "certified"

You should be able to install your certified app on a real Firefox OS phone after performing these steps from MDN:
On your computer, enter the following command in Terminal/console to enter your device's filesystem via the shell:
adb shell
Your prompt should change to root#android.
Next, stop B2G running using the following command:
stop b2g
Navigate to the following directory:
cd /data/b2g/mozilla/*.default/
Here, update the prefs.js file with the following line:
echo 'user_pref("devtools.debugger.forbid-certified-apps", false);' >> prefs.js
After you've finished editing and saving the file, start B2G again using the following command:
start b2g
Exit the android filesystem using the exit command; this will return you to your normal terminal prompt.

Related

SWUpdate API with Qt

I'm trying to update my application using SWUpdate tool for my embedded board.
I already created my .swu pack, anche with ssh command line, it works fine.
I need to launch the update from my Qt application.
How can I do?
Maybe I can launch QProcess::execute("swupdate -i /run/media/AppUpdate.swu"), but it still not working.
How can I link with Qt the SWUpdate API installed?
Thanks.
You did not state which Qt version you are using. The more recent ones deprecated the QProcess::execute call as you are using it (program name and arguments in one string).
Try this:
QProcess* proc = new QProcess;
proc->setProgram("swupdate");
proc->setArguments(QStringList({"-i", "path/to/your/update.swu"});
proc->start();
if (!proc->waitForStarted())
qCritical() << "failed to start swupdate: " << proc->errorString();
/*optional: block/wait for swupdate to finish*/
proc->waitForFinished(-1);
I recommend to also implement and connect the readyRead signal and save/log swupdate's output in case something goes wrong during the update.

Open MacOS Terminal window and execute command

I am working on an internal tool built with Electron that runs various NodeJS and shell scripts.
I want to open a default MacOS Terminal window and run a command. I am aware of and using NodeJS child_process functions like spawn(), fork(), and exec() for other purposes, but in some cases I would much prefer to open a desktop OS Terminal window because the command output is complex, includes escape codes, tails logs, and will be used by developers who may want to control the terminal after being launched by the app.
I tried using exec() and spawn() with open -a Terminal as described here and it simply did not open a Terminal window.
I currently have a solution based on this article that looks like this:
import {exec} from "child_process";
import os = require("os");
export function openTerminal(cmd: string) {
if (os.platform() !== 'darwin') throw new Error('Not supported');
const command = [
`osascript -e 'tell application "Terminal" to activate'`,
`-e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'`,
`-e 'tell application "Terminal" to do script "${cmd}" in selected tab of the front window'`
].join(" ");
const child = exec(command, (error, stdout, stderr) => {
if (error) {
console.error(error);
alert("Unable to open Terminal window, see dev console for error.");
}
});
child.on("exit", (code) => console.log("Open terminal exit"));
}
This works, but has some issues:
Initially the Electron app (built with electron-packager) is not allowed to run this command, and the user is prompted with "This app wants to control your computer". If the user accepts the dialog the command and subsequent commands still just fail to open a Terminal window. They have to go to OS Security/Accessibility settings, unlock admin privileges, set the app to allow control, close the app, then re-open. Then it might work.
Under working conditions (see above) it takes a painfully long time for the window to show up.
If Terminal is already open (which is usually the case) it often (but not always) fails to run the command in the new window, rather it will duplicate an existing tab and run the command in the original tab, which may not work if that tab was already running a command. Even if it does work this is not desirable, it should run the command in the new tab not an existing one.
Is there a way to open a terminal window in MacOS from Electron that avoids these problems?

cannot start service from the command line or a debugger. a windows service must first be installed Nodejs

i am creating a windows service that adds some data randomly to a database , so i used node-windows to implement it and when i run the file it creates an executable file and when i run that file i get "cannot start service from the command line or a debugger. a windows service must first be installed"
what should i do ??
here is the app.js file code :
var Service = require('node-windows').Service;
var svc = new Service({
name:'finaltest',
description: 'The nodejs.org example web server.',
script: 'testapp.js',
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
and this is the testapp.js file code :
var test = require('./models/test') ;
test.create({test : Math.random()}).then( () => {
console.log('hey') ;
})
setInterval(function(){
test.create({test : Math.random()}).then( () => {
console.log('hey') ;
})
}, 60000);
Before a Windows Service can run, it has to be "installed" first using installutil. EG:
C:\installutil -i c:\path\to\project\debug\service.exe
Using net stop [service name] to stop it and net start [service name] to start it up again basically restarting the service.
If so, you should make sure you have done the thing correctly. If tha't not what you want, please be more specific about what you are trying to do and feel free to let me know.
Firstly you should make sure your service code is working fine.
Secondly, if you are win7 or win8 os,
On the Windows Start menu or Start screen, choose Visual Studio, Visual Studio Tools, Developer Command Prompt.
A Visual Studio command prompt appears.
Run InstallUtil.exe from the command prompt with your project's output as a parameter:
installutil /u "yourproject".exe
Here is my screenshot,

Running protractor tests on IE 11

OK, so I have been searching a lot to get proper solution to the blocker I am facing right now. Let me give you a background of what I have done so far :
I want to run protractor tests (located on Linux machine) on IE 11 of Windows Server 2012 R2 (IP : 10.81.73.248). My protractorTest.conf.js has below :
exports.config = {
seleniumAddress: 'http://10.81.73.248:4444/wd/hub',
baseURL: 'http://10.81.78.137:80000/',
capabilities: {
browserName: 'internet explorer',
platform: 'ANY',
version: '11'
},
On my Windows Server 2012 R2 machine, I've downloaded IEDriverServer_Win32_2.47.0 and placed it under C:\Windows\System32, environment variable PATH has been updated with above location. Protected mode settings are same for all zones. Windows machine also has selenium-server-standalone-2.48.2.jar placed under C:\Users\Selenium.
On Windows machine, I am starting selenium server using below command :
java -jar selenium-server-standalone-2.48.2.jar -port 4444 -Dwebdriver.ie.driver="C:\Windows\System32\IEDriverServer_Win32_2.47.0\IEDriverServer.exe" , which starts selenium server fine.
With above settings, I run protractor tests from my Linux machine using grunt protractor_test, which launches IE browser on Windows machine, shows localhost:dynamic port and a message as : This is the initial page of webdriver server and within 2 seconds, closes the browser.
The exception I get on selenium server terminal is as below :
Session ID is null. Using WebDriver after calling quit() ?
This is where I am stuck at. I looked at various posts which describes similar issue (?) as mine along with the potential solution, but I am unable to resolve my issue here.
Is there anything I might be doing wrong to setup the connections ? or am I missing some steps to get me through ?
I would really appreciate if you guide me in resolving this long time pending blocker.
I think you are trying to run using old selenium version.It should be 2.53.x something.
Few basics things to check first regarding IE execution:
1).IE Setting for protractor(Selenium)
http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/
2).Take IE driver of 32 bit(don't take 64 it has known slowness issues) and manually copy on the following path:
Root Folder\node_modules\protractor\node_modules\webdriver-manager\selenium\IEDriverServer_Win32_2.53.1
3). IE Driver can be downloaded from following path:
http://selenium-release.storage.googleapis.com/index.html?path=2.53/
**OR**
Please upgrade your protractor version to latest like 4.0.11 by changing the version in package.json file and do from command prompt(inside project root directory):
npm update
and then give update your selenium driver with following command from command prompt
webdriver-manager update --ie
it will update the selenium version of IE driver to latest and then try running your tests again.

Launching instruments from command line with iPhone simulator

Following this question, how do I launch instruments with iPhone simulator as a device.
I tried this:
$ instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iphonesimulator5.0 MyApp.app
But I get this error:
Instruments Usage Error : Device failed to become ready for use.
-w <deviceID> is used only when you wish to specify a hardware device as the destination (the 'deviceID' here is the Identifier of the device, found in the Organizer of Xcode).
Instead of using -w, you can specify a flag during the build to force instruments to use iPhone. Details can be found here.
I was doing it as follows:
1.I created a template in which I was calling my UI Automation Main file that Triggers running all the scripts.
EX:
//Main.js file will run auto.js scripts
//auto.js is my main file in which I am running all the scripts
//Main.js file
#import "auto.js"
auto.run();
//Now open terminal and run the following command.
1. Go to the directory where you saved your template
2.Copy the location where you simulator (full path) is
Than run the command below:
instruments -t ./NameOfYourTemplate.tracetemplate /Users/swathyvalluri/Debug-iphonesimulator/MyApp.app
Note : Create a new file in the template and copy the contents into it what ever you want to put, otherwise it will look for Main.js file in your locally and will fail when running it on another server.
Please let me know if you need more help :)
Device id means here UDID of the device.
Also see the link below, it is very useful :
http://lemonjar.com/blog/?p=69

Resources