2

I am a developer and trying to block a specific model of the Samsung Galaxy Note4 in Google Play Developer Console, problem is I can't find a correlation between the device model to what they write in the console.

For example, I want to know what SM-N910C translates to from the below list I took from the console: enter image description here

Any ideas how to do that? Manually or programmatically... I don't think it's part of the http://developer.android.com/reference/android/os/Build.html

Sean
  • 5,176
  • 2
  • 34
  • 50

1 Answers1

1

So this is undoubtedly too late for you, but I have recently had the same question, so I decided to look into it, and I've developed a working theory.

I believe that the two strings that appear in the Google Play Developer Console are Android system properties. The more user-friendly one is "ro.product.model" and the other is "ro.product.device". This mapping appears to work, at least with the devices I have available right now. If anyone finds that these two values do not match what Google provides, please comment to that effect!

Programmatically reading Android system properties requires a JNI call into native code, like so:

package com.example;

class Native {
    // pass a String[2]
    public static native void readModelAndDevice(String[] _results);
}

-

#include <jni.h>
#include <sys/system_properties.h>

char model[256], device[256];

extern "C" JNIEXPORT void JNICALL com_example_Native_readModelAndDevice
(
    JNIEnv * _java, jclass _class, jobjectArray _array
)
{
    __system_property_get("ro.product.model", model);
    __system_property_get("ro.product.device", device);
    jstring jmodel = _java->NewStringUTF(model);
    jstring jdevice = _java->NewStringUTF(device);
    _java->SetObjectArrayElement(_array, 0, jmodel);
    _java->SetObjectArrayElement(_array, 1, jdevice);
    return;
}

Anyone who has never done JNI in Android Studio before should complete a JNI tutorial before trying this example.

j__m
  • 9,392
  • 1
  • 32
  • 56