Smartwatch Gear 2 - motion-detection

I have developed an application getting data from the Gear2 accelorometer.
The devicemotion events are managed by a window event listener such as:
window.addEventListener('devicemotion', function(e) {
Ax = e.accelerationIncludingGravity.x / 9.8;
Ay = e.accelerationIncludingGravity.y / 9.8;
Az = e.accelerationIncludingGravity.z / 9.8;
});
I need to run the application in background even if the screen is switched off.
I adopted the power setup:
tizen.power.request("SCREEN", "SCREEN_NORMAL");
tizen.power.request('CPU', 'CPU_AWAKE');
The problem:
when the screen is switched off (by means of the Home button) the motion event associated to the window is not fired. I think that if the window is not active then the listener itself is not active.
Somebody has any idea how to get the accelometer data even if the screen is off?
Regards
V

Yes, you can still get the data when app is running in background on pressing the home key.
Please add this in your config.xml
<tizen:setting background-support="enable"/>
This will enable your app to collect data in background as well. :)

Related

How to find which TVs are currently using my app?

I am developing an app for Android TV is it possible to know, on which TV my app is running or what action is performed on it?
Thank you.
To review your app's supported devices:
Sign in to your Play Console.
Select an app.
On the left menu, click
Release management > Device catalog. If you haven't already, review
and accept the Terms of Service.
Select the All, Supported, or
Excluded tabs. If you want to download a list of devices as a CSV
file, near the right side of the page, click Download device list.
For more infos:
https://support.google.com/googleplay/android-developer/answer/7353455
To track action performed on your app, you can use Fabric's Answers plug in.
Here is a sample code you'll need to add in your code to track events in Answers:
public void onKeyMetric() {
// TODO: Use your own string attributes to track common values over time
// TODO: Use your own number attributes to track median value over time
Answers.getInstance().logCustom(new CustomEvent("Video Played")
.putCustomAttribute("Category", "Comedy")
.putCustomAttribute("Length", 350));
}
For more infos:
https://fabric.io/kits/android/answers

Offline meteor application using ground:db

I am working with offline support of Meteor Application. I have researched about this support but all are giving one answer 'ground:db'. I looked into that solution its really nice effort by #raix. I started with that package, Its already working project so first task i have done that all collection i have grounded with following syntax
var Users = Meteor.users;
if(Meteor.isClient){
SmtGroundCollections.Users = Ground.Collection(Users);
}
After that i have tried with my offline application but still its showing loading and i am not getting my dom elements after that i have tried with that all waitOn subscription i have put on condition
if(Meteor.status().connected){
/* my subscriptions */
}
After that i am able to see my dom and if i visited that page when i am online then after i am going offline i am able to see my data.
Now i am explaining my problems.
1) When i am calling my methods its not updating my ground collection if i am offline. I used below code for resume my methods
if(Meteor.isClient){
Ground.methodResume([
'addProfie',
' editProfile' ,
' deleteProfile ' ,
]);
}
Its working fine when i am coming from offline to online its syncing my data to server but i am not able to immediate effect.
2) If i want full application offline then i need to visit every page of my mobile application and then i can get that data in offline but its not possible so i want one centralise thing where i will press button and i can grounded my all data which i want offline.
So can anyone help me to solve above problem
Thanks in advance

A-Frame Daydream control?

Just started playing with A-Frame and I can see vive-controls and oculus-touch-controls but nothing for google daydream.
I've looked at the component repo and don't see anything that looks like it'll do the job. The closest thing to now investigate would be the Gamepad API, but I'm amazed I can't find anything.
I've got a Pixel XL & daydream and would like to incorporate the controller rather than just head tracking and gaze based control. Can someone point me in the right direction please.
Thanks
UPDATE - I've got the Daydream controller working for clicks! Running the 360-image-gallery(https://aframe.io/examples/showcase/360-image-gallery/) accepts clicks from the Daydream controller. I guess maybe it had timed out on my previous attempts or I hadn't paired it properly! I'll keep playing!
Working on setting up a Daydream remote in an Aframe project. There are no components for the daydream remote yet, but I'm hoping to complete one soon – and it sounds like they are gonna mainline support in an upcoming Aframe release.
But you can hand roll support no problem.
First, there are a few things you'll need to do in preparation:
Download Chrome Beta 56 on your Pixel:https://www.google.com/chrome/browser/beta.html
.
Open Chrome Beta, navigate to chrome://flags and enable the WebVR and Gamepad flags.
Now, you will be able to launch experiences that are built with Aframe v0.4 or higher in true WebVR. You'll get prompted with the usual Daydream screens (place your phone in the headset, and connect the remote.) If you are connecting to a local development environment, you'll see a secure connection warning but this, while annoying, won't stop you from working.
Second, now that you are running true WebVR, you need to leverage the Gamepad API to get information from your daydream remote. Lets start by just logging that it is connected.
window.addEventListener('gamepadconnected', function(evt) {
console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.",
e.gamepad.index, e.gamepad.id,
e.gamepad.buttons.length, e.gamepad.axes.length);
});
Third, now that you are logging a connection, you will need to setup an update loop to get the current state of the Gamepad. You can do this with requestAnimationFrame. Follow the tutorial here: https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API
Once I've published a basic dayframe-remote component, I'll post a link here. Hope this helps get you started!
EDIT: Looks like the suggestion below works great. Just pass "Daydream Controller" as the id for tracked controls: tracked-controls="id: Daydream Controller".
Here is a sample Daydream controller output. At the moment, only the trackpad button appears to be exposed – not the app or home buttons.
{
axes: [0, 1],
buttons: [{
pressed: false,
touched: false,
value: 0
}],
connected: true,
displayId: 16,
hand: "left",
id: "Daydream Controller",
index: 0,
mapping: "",
pose: {
angularAcceleration: null,
angularVelocity: [0, 0, 0],
hasOrientation: true,
hasPosition: false,
linearAcceleration: [0,0,0],
orientation: [0,0,0,1],
position: null
},
timestamp: 1234567890123
}
Something for you to try...
the way the current A-Frame 0.4.0 support in tracked-controls should work:
if you specify that it should only match an ID value of empty string '' then it should match any gamepad with a pose... so you can try something like
<a-entity tracked-controls="id:"></a-entity>
and see if that gets events etc.?
A-Frame master branch now contains a daydream controller component: https://aframe.io/docs/master/components/daydream-controls.html

Send future clients to right monitor in awesome?

I'm trying to implement a very customized implementation of awesome.
I have two monitors. I'd like to have my first client always open on the left monitor (a Chrome window in kiosk mode), then all clients after open up on the right monitor.
Are there any custom layouts that accomodate this?
I'd be willing to program it myself, but I'm not sure how to bind a script to some kind of "new client" event.
The new client event is the manage event. It is emitted whenever, well, a new client gets managed by awesome.
To send the first client that ever appears to screen 1 and all following ones to screen 2, you could do something like this:
local first = true
client.connect_signal("manage", function(c)
if first then
c.screen = 1
else
c.screen = 2
end
first = false
end)

how to open recent app list panel via Monkeyrunner

for automation testing using monkeyrunner, i want to launch a app from recent app list panel, while the panel cannot be opened after long press HOME key via monkeyrunner command.
device.press('KEYCODE_HOME',MonkeyDevice.DOWN)
Monkeyrunner.sleep(5)
device.press('KEYCODE_HOME',MonkeyDevice.UP)
with the above code, the press is acted as a short press. And the panel can be opened after long pressing HOME key manually. is there some solution for this issue?
Thanks.
You can use the coordinates of the home button and simulate a long touch on those exact coordinates:
device.touch(x, y, MonkeyDevice.DOWN)
MonkeyRunner.sleep(3)
device.touch(x, y, MonkeyDevice.UP)
Where (x, y) are the coordinates of the home button. You can get these by going to the developer options and select pointer location and observe the coordinates as you touch the home button.
Also, there is a specific key event for app switching:
device.press(' KEYCODE_APP_SWITCH', MonkeyDevice.DOWN_AND_UP)
This should open the recent apps panel.

Resources