JS return android ID

Wesley Johnston wjohnston at mozilla.com
Tue May 20 09:26:58 PDT 2014

I'm not sure what Fence is, but if you want to try and access Java constants in JS, you might try using JNI.jsm. We ship a really limited version that won't do enough for you, but there's a pretty nice version at:


that we've been looking to include in Fennec (bug 918309). With it you can do something like (I'm writing this out of my head, so it may be very wrong):

  let Secure = JNI.LoadClass(jenv, "android.provider.Settings.Secure", {
    static_fields: [
      { name: "ANDROID_ID", sig: "I" }

and then just use Secure.ANDROID_ID in your code.

That help?

- Wes

----- Original Message -----
From: "Benson Chen" <benson.chen78 at gmail.com>
To: mobile-firefox-dev at mozilla.org
Sent: Tuesday, May 20, 2014 7:21:20 AM
Subject: JS return android ID

Hi All 

I want to add one feature for Fence, which use JS to return Settings.Secure.ANDROID_ID . 
Should I develop one Add on or add one module in Fence? Can anyone give some hits to me? 


mobile-firefox-dev mailing list
mobile-firefox-dev at mozilla.org

More information about the mobile-firefox-dev mailing list