Using the accelerometer in a Windows Phone 8 device to determine if device is not moving - windows-phone-8

I'm looking at trying to make my WP8 app more accurate in terms of location detection by making use of the accelerometer to detect if the device has stopped moving (in the context of driving, so horizontally only presumably).
I've read about the Motion API which is apparently the thing to use as it removes some of the complexity and calculations required when referencing the accelerometer directly. But i'm ensure has to how to use the data in the correct way, MotionReading.DeviceAcceleration etc.
Can anyone suggest the best/simplest way to determine if the device has stopped moving using this API or otherwise if there's a better way?
Thanks.

From my point of view, it really depends where do you want to use your app. If it is an outdoor application then as Igrali mentioned using GPS would be a better option. However, if you are still sure that you want to use accelerometer one way that I tried before was save last few results of the accelerometer every time then check them with previous results. if the result was same it means the system is stopped otherwise it is moving. That may not be a good way but it works.

Related

Why do I need to clear cache (chrome) on my phone every time I want to use auto complete? (google places)

My problem is quite simple. I built an app that uses google places autocomplete to identify an address.
In order for auto complete to function, I need to clear the cache on my phone. If I do, it will work. But if I want to re-use it a second time, I will need to go through the same process again.
This doesn't seem to be happen on my laptop though.
2 questions:
Why does it do that?
Is there something than can be done to address this problem? (users will definitely bother with clearing their cache every time they want to use the app)
I haven't left any code, as I am not sure it has to do with the actual code but I am happy to share whatever you want to see.
Just in case, I am using django (python framework) if that helps, and Chrome as my browser.

Can I Navigate back to my application upon reaching a destination using Device.OpenUri?

I have done some research for xamarin.forms to see what is the best way to navigate to a driving destination (longitude, Latitude) with excellent user controls. It seems there is no point in re-inventing the wheel, especially when its as complicated as googles fantastic maps solution.. So it seems there are two legal and simple ways: a embedded browser control / webview, or using Device.OpenUri.
So, Device.OpenUri is the most responsive, and easy way to get someone to a destination but how can I return the user to my app after they reach their destination? I would prefer not to rely upon them pressing the 'back' button to exit maps as this might be not intuitive to the user.
What do you think?
EDIT: ok so I realized my question is not maps related at all, because its not hard to track the phones GPS location. All I need to accomplish this, is: to re-activate (or 'Show') my app. So after I call Device.OpenUri, I think my app will still be running, so regardless of what program is currently 'on top' or active, what code can I run to bring back the current app? Or, would this need to be a 'notification' which would then allow the user to manually switch back?

Windows Phone 8 saving video stream to file after event trigger

I'm looking for some suggestions or pointers on where to look or how to get started with a project for Windows Phone 8.1. The idea is pretty simple in my mind. I want to constantly record video to a memory stream only keeping say the last five seconds, then an event will trigger saving the video steam to a file on to the phone.
I was originally thinking I could save raw frames to a ring buffer and define the size based on the raw frame size * sample rate. Now I realize that might not work because the video provided by the MediaCapture class will be encoded. Digging on stackoverflow, I came across the idea of using MFTs but it sounds a lot more complicated than I originally had in mind.
Looking around the Development Reference material on MSDN, I'm guessing the MediaCapture class will be my friend. Can I somehow define a fixed size stream for use with MediaCapture.StartRecordToStreamAsync then on my event connect it to MediaCapture.StartRecordToStorageFileAsync? Or perhaps there might be a more appropriate way to do this that I should investigate?

How can I tell if a Chrome app is already running

I'm looking for means of telling whether other instances of a Chrome app are already running but Chrome's excellent context isolation makes it quite difficult.
Also, I was hoping chrome.runtime APIs would help but it doesn't seem to be the case.
Essentially, I want to make sure only one instance can run at any given time.
Thanks!
Your background page can store global state that lets you keep track of which windows have been launched by the app.
Your app can only have one background (or event) page at a time.
If you are wanting to prevent multiple windows from launching, make sure your chrome.app.window.create call has an "id" option. That means only one window will be created with that given id.

which rendering way should I use in a web based project

I have a database of 3D models. I want user can rotate the model and view it in the web page.
So I have to implement an instant rendering algorithm for this.
A raytracing/raycasting method on CPU is preferred since the server has no GPU on it.
I understand that a primary-ray-only ray tracer with SSE and KD-Tree/BVH can be very fast. Besides, I want to add some GI effect(fake GI effect can be also OK for me, such as SSAO) in it.
How good can I achieve?
(some NPR rendering methods are also considerable)
In HTML5, you can render 3D objects with WebGL (an implementation of OpenGL) with some JavaScript. The problem is that WebGL is a client technology. Therefore, all the rendering is done by the browser.
There is one possible solution if you really want to distribute some logic on a server. You could use a server side language and send the vertices to the client through some database transactions. After, your website could make some AJAX calls to a server that would make certain operations within the server and return some vertices. The only problem is that this could require a lot of bandwidth.
Otherwise, another solution would be to use a tool such as Unity to create what you want. Then, you would need to embed the Unity Player in your web page.