Giter Site home page Giter Site logo

Comments (7)

rampara avatar rampara commented on July 24, 2024 1

@Mirkoddd yes. choosing to collect consent yourself and forwarding consent status to the Consent SDK is always an alternative.

from googleads-consent-sdk-android.

frankyxcs avatar frankyxcs commented on July 24, 2024

yes i have this bug too

                android.graphics.drawable.AdaptiveIconDrawable cannot be cast to android.graphics.drawable.BitmapDrawable

Reason could be "But since Android 8.0 you can set an adaptive icon, which is not a bitmap, thus the App Theme Engine crashes on it."

see also
https://stackoverflow.com/questions/50077917/android-graphics-drawable-adaptiveicondrawable-cannot-be-cast-to-android-graphic

from googleads-consent-sdk-android.

rampara avatar rampara commented on July 24, 2024

@frankyxcs @tialawllol this crash does seem to be caused by AdaptiveIconDrawable failing to cast to Bitmap. Will be fixed in a upcoming release but as a workaround you can update the getAppIconURIString() method of ConsentForm to the following:

private static String getAppIconURIString(Context context) {
        Drawable iconDrawable = context.getPackageManager().getApplicationIcon(context
            .getApplicationInfo());
        Bitmap bitmap = Bitmap.createBitmap(iconDrawable.getIntrinsicWidth(),
            iconDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
        final Canvas canvas = new Canvas(bitmap);
        iconDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        iconDrawable.draw(canvas);
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
        byte[] byteArray = byteArrayOutputStream.toByteArray();
        return "data:image/png;base64," + Base64.encodeToString(byteArray, Base64.DEFAULT);
    }

from googleads-consent-sdk-android.

Mirkoddd avatar Mirkoddd commented on July 24, 2024

@rampara in the meantime I can also choose to implement a custom dialog, right?

from googleads-consent-sdk-android.

rampara avatar rampara commented on July 24, 2024

Issue should be resolved in d1c28e0.

from googleads-consent-sdk-android.

olivierbernal avatar olivierbernal commented on July 24, 2024

@rampara: Thanks for this fix. When do you plan to push it to gradle?

from googleads-consent-sdk-android.

rampara avatar rampara commented on July 24, 2024

Just pushed v1.0.2 to gMaven.

from googleads-consent-sdk-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.