Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which phones support Android Polyfill? #54

Open
hpssjellis opened this issue Jun 7, 2023 · 14 comments
Open

Which phones support Android Polyfill? #54

hpssjellis opened this issue Jun 7, 2023 · 14 comments

Comments

@hpssjellis
Copy link

hpssjellis commented Jun 7, 2023

@reillyeon

Can we just list the phones that support Android Polyfill

I have it working on a Google Pixel V2. So I am going to guess that it works on all Pixel phones.

I think I had it working on a Samsung Galaxy S19, but it does not presently work on my Galaxy S4, S8 or my latest S22 Ultra. I am going to assume polyfill does not work on the Samsung brand.

Has anyone tried Polyfill with any of these brands?

Samsung     : doesn't work
Google Pixel  2 and 3:  Works, Not for my Pixel 6
OnePlus
Xiaomi   Works (user reported Redmi K40)
Oppo
Vivo
Motorola
LG
Sony
Nokia

If anyone wants to test their phone my WebSerial and Android Polyfill webpage is here The Arduino sketch for it is here but I will inline it below:


/*
 * webSerial for testing javascript connection with an arduino
 * 
 * 
 * Android https://hpssjellis.github.io/web-serial-polyfill/index.html
 * Laptops Desktops  https://hpssjellis.github.io/my-examples-of-arduino-webUSB-webSerial/public/index.html
 * IOS     not really sure
 * 
 */



#include <Arduino.h> // Only needed for https://platformio.org/

String readString;

int myDelay = 5000;   // non-block delay in milliseconds
unsigned long myStart; 
int serialMessage = 1;
int myCount=48;      //48 = ascii 0,    58 ascii 9

void setup() {
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);   // onboard LED, HIGH = off
  
  myStart = millis();   // set delay
  randomSeed(analogRead(A0));  // AO pin on XIAO does not have to be connected to anything

}

void loop() {

  if ( (millis() - myStart ) >= myDelay) {       
     myStart = millis();      //  reset the delay time
     myCount++;
     if (myCount >= 58){ // 48 = ascii 0,    58 ascii 9
       myCount = 48;
     }       
     //char myChar = (char)myCount;      
     byte myChar = (byte)myCount;    
     Serial.write(myChar);  
   }

  

  while (Serial.available()) {
    delay(3);  
    char c = Serial.read();
    readString += c; 
  }

  if (readString.length() > 0) {
    readString.trim();  // get rid of last weird character
    Serial.println(readString);

    if (readString == "a"){
      digitalWrite(LED_BUILTIN, LOW); //onboard LED LOW = on
      Serial.println("LED ON");
    }
    if (readString == "b"){
      digitalWrite(LED_BUILTIN, HIGH);
      Serial.println("LED OFF");
    }
    readString="";
  } 
}

@liux-pro
Copy link

Xiaomi Redmi K40 works fine

@hpssjellis
Copy link
Author

Thank you so much @liux-pro

@faliqulamin
Copy link

Samsung A52s 5G not work

@karelv
Copy link

karelv commented Nov 23, 2023

Samsung 21 Ultra works, except for #59.

@hpssjellis
Copy link
Author

@karelv @liux-pro I got a used Pixel6 which I expected to work easily, but it starts to connect but then disconnects. Did either of you do anything special to make it work?

@reillyeon are their any changes to webSerial that can make connecting Arduinos easier?

@reillyeon
Copy link
Collaborator

@reillyeon are their any changes to webSerial that can make connecting Arduinos easier?

https://bugs.chromium.org/p/chromium/issues/detail?id=1099521 tracks the work to make the polyfill work relibly across all Android devices.

@karelv
Copy link

karelv commented Jan 9, 2024

@karelv @liux-pro I got a used Pixel6 which I expected to work easily, but it starts to connect but then disconnects. Did either of you do anything special to make it work?

No, I didn't do anything on the phone.
I can just add that it didn't work on Google Pixel 8 pro either, while Pixel 2 did work.

@hpssjellis
Copy link
Author

Thanks so much @karelv for replying. Do you know if your Pixel 2 still works and what version of chrome you are running on it. I purchased a Pixel 6 just because I thought it would work, and was very sad when it didn't.

Also thanks @reillyeon for replying on the chrome issue I feel strange about them locking us out from commenting. It is a real issue and I would help if I could. I feel like there should be an APP that we could load that would allow us to use the webUSB driver that your polyfill uses.

By the way I am doing really well with my WebSerial machine learning project. This website here allows the very new ~15 USD RAK2270 sticker tracker to run a motion x,y,z machine learning model all programmed on a static webpage connected by webSerial to the tracker. It would be very powerful to be able to do some of this ML model building using an Android phone.

@reillyeon
Copy link
Collaborator

Also thanks @reillyeon for replying on the chrome issue I feel strange about them locking us out from commenting. It is a real issue and I would help if I could. I feel like there should be an APP that we could load that would allow us to use the webUSB driver that your polyfill uses.

That GitHub repository isn't the Chrome issue tracker. It's for the developer.chrome.com documentation site which is why your issue was closed. I linked to the real Chrome issue tracker where we are already tracking this.

@hpssjellis
Copy link
Author

Thanks @reillyeon that is a good read. It is a bit out of my level of coding but does this github offer some suggestions, or is it totally different than our issues?

https://github.com/mik3y/usb-serial-for-android

@reillyeon
Copy link
Collaborator

https://github.com/mik3y/usb-serial-for-android

That repository has Java code which could be ported to JavaScript in order to allow this polyfill to support more types of devices, but that won't fix the issue you're running into. What code using the Android SDK directly (that library) can do but code using WebUSB (this library) cannot do is forcibly claim a USB device interface that is in use by another driver. That is what the Chromium issue I linked to is about fixing.

@hpssjellis
Copy link
Author

@reillyeon that makes sense. Thanks for explaining it. I would really like to have an android device and chrome version that works with your Polyfill so I can mess around with it. I wish we could talk with the Pixel developers, perhaps they would have some suggestions. I do feel that there is a work around to this we just don't have enough information about why the USB devices are being claimed when they have only just been plugged in.

Please mention if you have any suggestions for who to talk to. I am very persistent.

@karelv
Copy link

karelv commented Jan 10, 2024

I'm less persistent, but still interested!

FYI: yes pixel 2 still works, versions:
Chrome 112.0.5615.135
Android 11; Pixel 2 Build/RP1A.201005.004.A1

@hpssjellis
Copy link
Author

That is great @karelv I will have to find one of those phones. Here is what I am doing with webSerial here

The latest work is called "Next Acceleration" you can mess around with it using your cell phone accelerometer, but it is really for making machine learning models for arduinos using static webpages with TensorflowJS.

No explanation videos until I have it fully working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants