简体   繁体   中英

Windows Phone 7 and Javascript Accelerometers

Is there a way to gain access to the Accelerometer data via Javascript on a Windows Phone 7?

The iPhone has this demo example (that works lovely in Safari mobile): http://hakim.se/experiments/css/holobox/

The section of iPhone Javascript is as follows:

if (navigator.userAgent.match(/(iPhone|iPad|iPod|Android)/i)) {
        addEventListener("orientationchange", onOrientationChange, false);
        addEventListener("devicemotion", onMotionChange, false);
    }

I just wondered whether you can access the data on WP7 as well.

Cheers!

No. This is not possible. Even in Mango.

There are some cross-platform javascript libraries that allow you to access the Accelerometer and other services on some phones. You have PhoneGap for instance.

As far as I know, none of these allow you to access the services on the WP7 yet.

In the upcoming Mango update for WP7 html/javascript apps are supposed to be supported, so you may want to download the beta SDK and check there. I don't know whether the beta supports this information but it should be easy to check.

Check out this project on Codeplex for more information: http://htmlappwp7.codeplex.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM