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

GoogleAdID & SimOperatorName "null" #33

Open
lars18th opened this issue Nov 14, 2017 · 3 comments
Open

GoogleAdID & SimOperatorName "null" #33

lars18th opened this issue Nov 14, 2017 · 3 comments

Comments

@lars18th
Copy link

Hi,

In the UI, in the Original section, I see that these two values are empty:

  • GoogleAdID (googlead_id)
  • SimOperatorName

Also, I see the same result ('null') in the new "mydevice.htm" file.

These are the only values empty in my device.
I feel we need to verify the code and check about how to recover these values. I'm using Stock Android 7.0.

@lars18th
Copy link
Author

Hi @bigsinger ,

Identical behaviour in v1.20.
Only for your information.

@bigsinger
Copy link
Owner

my SimOperatorName value is not empty.

how to get googlead_id?

@lars18th
Copy link
Author

my SimOperatorName value is not empty.

Please, share the code you use for read it.

how to get googlead_id?

https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient?hl=vi

However, you need to add this to the AndroidManifest.xml:

<meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

Source example:

/** Retrieve the Android Advertising Id 
     * 
     * The device must be KitKat (4.4)+ 
     * This method must be invoked from a background thread.
     * 
     * */
    public static synchronized String getAdId (Context context) {

        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) {
            return null;
        }

        AdvertisingIdClient.Info idInfo = null;
        try {
            idInfo = AdvertisingIdClient.getAdvertisingIdInfo(context);
        } catch (GooglePlayServicesNotAvailableException e) {
            e.printStackTrace();
        } catch (GooglePlayServicesRepairableException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        String advertId = null;
        try{
            advertId = idInfo.getId();
        }catch (NullPointerException e){
            e.printStackTrace();
        }

        return advertId;
    }

And remember that in fact for hooking the value, you don't need to read it! 😄

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

2 participants