Mobile examples with accelerationX are not working?


A few weeks ago the mobile example ex03_shake_ballBounce was working well for me, and I’d made a version with coloured balls. Today the accelerationX and Y are returning zero. A few days ago I updated to P5.JS 1.2, can’t remember what I had before. (In the examples now all the 'var’s are 'let’s). I’ve copied the latest p5.min.js 8/May/2019 from the examples to my sketch/libraries Processing is 3.3.6 I did the download from the Contribution Manager. I went looking for a change list but for downloading P5.js I can only find 0.8.

For the P5.js source and server I’ve tried 2 PCs, and for the web-page I’ve tried two phones.

Please would someone try from examples, mobile, ex03_shake_ballBounce then shake the phone. Do all the balls go faster?


besides revisions related questions p5.js there is also the issue
of a security fix in browser, a they ignored the privacy violation for years but recently changed something.
did you search the forum already?

Thanks. I did have a look at the forum, and the list it offers as you create the topic didn’t have anything close. I think I have a non-updated PC, I’ll try later today.

Forgot about this for a few weeks. Now made a small program that prints accelerations on screen. it also shows the maximum accelerations because they are eassier to watch than the instant value.

I’ve tried this program on various PCs and phones. It runs well on a discarded Sony Xperia running Android 4.4.2 (A). Fails on Samsung Galaxy-5 running Android 6.0.1(B). The values just show zero.

Phone A doesn’t do the graphics part of the program, but it does print acceleration values. On phone B I looked at the permissions for the Chrome application. Couldn’t see a way to give it more permissions.

Why was it alright a few months ago? What’s gone wrong? Please would someone try the acceleration examples.

// Store maximum acelerations
  var xX = 0.0;
  var xY = 0.0;
  var xZ = 0.0;

function setup() 
  createCanvas(displayWidth, displayHeight);

function draw() 
  var aX;
  var aY;
  var aZ;
  rect(0, 0, 850, 600);
  text(frameCount   , 600,  50);
  // Get acceleration Values
  aX = accelerationX;
  aY = accelerationY;
  aZ = accelerationZ;
  // Show acceleration on screen
  text(aX, 600,  90);
  text(aY, 600, 130);
  text(aZ, 600, 170);

  // Store maximum acceleration
  if (aX > xX) xX = aX;
  if (aY > xY) xY = aY;
  if (aZ > xZ) xZ = aZ;
  // Show max acceleration.
  text(xX, 600, 240);
  text(xY, 600, 280);
  text(xZ, 600, 320);