Consent für Admob mit ump / funding choices

celdri

Mitglied
Hallo zusammen,

um gdpr-konform zu sein, habe ich folgende Anleitung befolgt: https://developers.google.com/admob/ump/android/quick-start

Gemacht hab ich folgendes:
  • funding choices mit admob verbunden
  • ump zu build.gradle zugefügt
  • app ID im android manifest eingetragen
  • einen Dialog für meine App in admob erstellt und aktiviert
Dann habe ich diesen Code in die App eingefügt:

Java:
ConsentRequestParameters params = new ConsentRequestParameters
                .Builder()
                .setTagForUnderAgeOfConsent(false)
                .build();

        consentInformation = UserMessagingPlatform.getConsentInformation(this);
        consentInformation.requestConsentInfoUpdate(
                this,
                params,
                new ConsentInformation.OnConsentInfoUpdateSuccessListener() {
                    @Override
                    public void onConsentInfoUpdateSuccess() {
                        // The consent information state was updated.
                        // You are now ready to check if a form is available.
                        if (consentInformation.isConsentFormAvailable()) {
                            loadForm();
                        }
                        else {

                            Context context = getApplicationContext();

                            CharSequence toastText = "No Form Available";

                            int duration = Toast.LENGTH_LONG;

                            Toast toast = Toast.makeText(context, toastText, duration);
                            toast.show();
                        }

                        
                    }

                },
                new ConsentInformation.OnConsentInfoUpdateFailureListener() {
                    @Override
                    public void onConsentInfoUpdateFailure(FormError formError) {

                        Context context = getApplicationContext();

                        CharSequence toastText = "Error";

                        int duration = Toast.LENGTH_LONG;

                        Toast toast = Toast.makeText(context, toastText, duration);
                        toast.show();

                    }
                });

und

Java:
public void loadForm() {
        UserMessagingPlatform.loadConsentForm(
                this,
                new UserMessagingPlatform.OnConsentFormLoadSuccessListener() {
                    @Override
                    public void onConsentFormLoadSuccess(ConsentForm consentForm) {
                        MainActivity.this.consentForm = consentForm;
                        if(consentInformation.getConsentStatus() == ConsentInformation.ConsentStatus.REQUIRED) {
                            consentForm.show(
                                    MainActivity.this,
                                    new ConsentForm.OnConsentFormDismissedListener() {
                                        @Override
                                        public void onConsentFormDismissed(@Nullable FormError formError) {
                                            // Handle dismissal by reloading form.
                                            loadForm();
                                        }
                                    });

                        }
                    }
                },
                new UserMessagingPlatform.OnConsentFormLoadFailureListener() {
                    @Override
                    public void onConsentFormLoadFailure(FormError formError) {
                        // Handle the error
                    }
                }
        );
    }

Leider bekomme ich immer den "Error"-Toast und lande in onConsentInfoUpdateFailure(FormError formError) unabhängig ob ich auf meinem Handy oder auf einem virtuellen Device teste.

Kann mir da jemand helfen, fehlt mir noch was?


Danke und Grüsse
celdrion
 

Jw456

Top Contributor
Im allgemeinen ist es so das die Werbung erst geschaltet wird wenn du die App bei Google play hochgeladen hast.
Zum test benutze die test ID und nicht deine die du für deine App erstellt hast.
 

celdri

Mitglied
Danke euch schon mal für eure Antworten. Ja sorry, den Fehler habe ich vergessen zu posten...
Logcat gibt eine Warning aus: "UserMessagingPlatform: Invalid response from server."
formError message ist nur: "Invalid response from server"

Im allgemeinen ist es so das die Werbung erst geschaltet wird wenn du die App bei Google play hochgeladen hast.
Zum test benutze die test ID und nicht deine die du für deine App erstellt hast.
Das Problem ist aber nicht die Werbung, die Testanzeigen funktionieren, wie sie sollen. Das Problem ist "nur" das Formular für den Consent.

Noch zur Info, folgende Permissions habe ich im manifest:
XML:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
 

Jw456

Top Contributor
Perkussion sind ok.
Wenn es am Formular ligen soll dann zeige mal dein layout.

Nur wenn dein Layout nicht ok ist würde es mit der test ID nicht gehn.
 

celdri

Mitglied
Hier ist mein Layout zur Main Activity, das wird dann auch ganz normal geladen:

XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <include
        android:id="@+id/toolbar"
        layout="@layout/toolbar_layout"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_alignParentTop="true" />

    <ImageView
        android:id="@+id/logo"
        android:layout_below="@id/toolbar"
        android:layout_marginTop="40dp"
        android:layout_marginLeft="40dp"
        android:layout_marginRight="40dp"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        app:srcCompat="@drawable/titel" />

    <Button
        android:id="@+id/button1"
        android:layout_below="@id/logo"
        android:layout_marginTop="40dp"
        android:layout_marginLeft="-5dp"
        android:layout_marginRight="40dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAlignment="viewEnd"
        android:paddingRight="40dp"
        android:textColor="@color/button_textColor"
        android:text="@string/button1_string" />

    <Button
        android:id="@+id/button2"
        android:layout_below="@id/button1"
        android:layout_marginTop="20dp"
        android:layout_marginRight="-5dp"
        android:layout_marginLeft="40dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAlignment="viewStart"
        android:paddingLeft="40dp"
        android:textColor="@color/button_textColor"
        android:text="@string/button2_string" />

    <Button
        android:id="@+id/button3"
        android:layout_below="@id/button2"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="-5dp"
        android:layout_marginRight="40dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAlignment="viewEnd"
        android:paddingRight="40dp"
        android:textColor="@color/orange"
        android:text="@string/button3_string"
        />

    <Button
        android:id="@+id/button4"
        android:layout_below="@id/button3"
        android:layout_marginTop="20dp"
        android:layout_marginRight="-5dp"
        android:layout_marginLeft="40dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/button4_string"
        android:textAlignment="viewStart"
        android:paddingLeft="40dp"
        android:textColor="@color/orange" />

    <Button
        android:id="@+id/button5"
        android:layout_below="@id/button4"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="-5dp"
        android:layout_marginRight="40dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAlignment="viewEnd"
        android:paddingRight="40dp"
        android:textColor="@color/orange"
        android:text="@string/button5_string" />

    <Button
        android:id="@+id/button6"
        android:layout_below="@id/button5"
        android:layout_marginTop="20dp"
        android:layout_marginRight="-5dp"
        android:layout_marginLeft="40dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/button6_string"
        android:textAlignment="viewStart"
        android:paddingLeft="40dp"
        android:textColor="@color/orange" />


</RelativeLayout>
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
Kazudemruzo Android API/Library für externe Entwickler zur Verfügung stellen Android & Cross-Platform Mobile Apps 7
B Was fehlt mir hier für diese Klasse? ich habe es mit (>>> ... <<<) markiert. Android & Cross-Platform Mobile Apps 4
J SharedPreferences für User-Session Android & Cross-Platform Mobile Apps 2
M Barrierefreie Appentwicklung für Android - Suche Codebeispiele Android & Cross-Platform Mobile Apps 8
I App für Fire HD entwickeln Android & Cross-Platform Mobile Apps 3
T Bringen mir die Java-Basics irgendetwas für die Android-Programmierung Android & Cross-Platform Mobile Apps 4
L Textfeld für Dezimalzahl mit Vorzeichen Android & Cross-Platform Mobile Apps 2
J Android Datenbank Klasse nur für CRUD-Operation, oder auch mehr ? Android & Cross-Platform Mobile Apps 8
B Android Projekt für Android und IOS erstellen? Android & Cross-Platform Mobile Apps 5
J Impressumspflicht für App, wenn ich kein Unternehmer bin? Android & Cross-Platform Mobile Apps 13
T Android Equalizer für Android Android & Cross-Platform Mobile Apps 3
L Zeitstempel für Sensordaten bekommen Android & Cross-Platform Mobile Apps 3
L Android Texterkennung für Android? Android & Cross-Platform Mobile Apps 1
L Android Chart API für Android Android & Cross-Platform Mobile Apps 0
T Android Datenbankverbindung in Service für Push Notification Android & Cross-Platform Mobile Apps 0
R Android USB Treiber für Huawei Android & Cross-Platform Mobile Apps 1
M Hilfe bei App Programmierung für Android Android & Cross-Platform Mobile Apps 1
B Script für Android Android & Cross-Platform Mobile Apps 1
H Datenprotokoll für Graphview Android & Cross-Platform Mobile Apps 2
M Android Obfuscation für Strings Android & Cross-Platform Mobile Apps 8
S Bilder mit fester grösse für verschiedene Android Endgeräte Android & Cross-Platform Mobile Apps 2
D Android Layout für alle Geräte Android & Cross-Platform Mobile Apps 4
A String[] für Lisadapter Android & Cross-Platform Mobile Apps 4
D Lib für (Desktop-)Java und Android schreiben Android & Cross-Platform Mobile Apps 7
J MySQL Simulation für Android App Android & Cross-Platform Mobile Apps 2
kaoZ Tutorial .xml Layouting für z.B ListView elemente Android & Cross-Platform Mobile Apps 7
W Java Editor für Android +Emulator Android & Cross-Platform Mobile Apps 7
M 20 Image Button für jede Auflösung positionieren Android & Cross-Platform Mobile Apps 3
L Android ActionBar mit unterschiedlichen Farben für Tabs Android & Cross-Platform Mobile Apps 3
S Voraussetzungen für Android-Apps Android & Cross-Platform Mobile Apps 7
R Sinnvoller Ablageort für Leveldaten Android & Cross-Platform Mobile Apps 8
B App bei Play-Store für bestimmte auflösungen anbieten? Android & Cross-Platform Mobile Apps 3
G extends Activity für Berechnungen? Android & Cross-Platform Mobile Apps 7
H Progrämmchen für Symbian Android & Cross-Platform Mobile Apps 4
G wiederkehrenden Wert für Design in XML ablegen Android & Cross-Platform Mobile Apps 2
L Android SearchBox für Custom Listview Android & Cross-Platform Mobile Apps 5
T Android KontrollApp für Nitrado Server Android & Cross-Platform Mobile Apps 2
L Android Eine Kleinigkeit für Profis Android & Cross-Platform Mobile Apps 2
G Android C++ Quellcode für Android Geräte compilieren Android & Cross-Platform Mobile Apps 2
T Zeit in zwei Zahlen für Widget zerlegen Android & Cross-Platform Mobile Apps 2
J Apps für Android programmieren - Android Handy notwendig oder reicht Simulator? Android & Cross-Platform Mobile Apps 3
A Android SimpleDateFormat gibt für Date unter android anderes Datum zurück als in Std. Java Android & Cross-Platform Mobile Apps 2
H Android Landscape Modus für App dektivieren Android & Cross-Platform Mobile Apps 3
M Frage zu Java Programm für Windows Mobile 6.5 Android & Cross-Platform Mobile Apps 2
H Welches JDK für Huawei G7002? Android & Cross-Platform Mobile Apps 6
C Panel/View für Android Android & Cross-Platform Mobile Apps 3
C Sanke für Android Android & Cross-Platform Mobile Apps 3
Kukulkan Welche Mindestanforderungen (JDK) für Android und BB? Android & Cross-Platform Mobile Apps 8
G Views für verschiedenen Bildschirmgroeßen Android & Cross-Platform Mobile Apps 2
thE_29 Widget für verpasste Anruf + SMS Android & Cross-Platform Mobile Apps 2
A Android Android Parameter für VM Android & Cross-Platform Mobile Apps 7
O Entwickler für Java Anwendungen auf Handy gesucht! Android & Cross-Platform Mobile Apps 3
S JButton in GUI für Handys? Android & Cross-Platform Mobile Apps 3
M Welche Datenbank für J2ME? Android & Cross-Platform Mobile Apps 5
D Event für Tastensperre? Android & Cross-Platform Mobile Apps 3
G WTK für Nokia Android & Cross-Platform Mobile Apps 2
P bestimmte API für XDA ORBIT2 Android & Cross-Platform Mobile Apps 3
S Idee gesucht für ein kleines Programm Android & Cross-Platform Mobile Apps 3
M ein image pixel für pixel aufbauen : setPixel() ? Android & Cross-Platform Mobile Apps 1
M Handyprogramm für U-Bahn-Fahrplan für Siemens SK65 Android & Cross-Platform Mobile Apps 2
J Empfehlungen für ME-Anfänger Android & Cross-Platform Mobile Apps 2
K Anwendung für Handy programmieren Android & Cross-Platform Mobile Apps 1
P Java für PDA DELL Axim 51 Android & Cross-Platform Mobile Apps 4
M Virtuelle Machiene für PDA Android & Cross-Platform Mobile Apps 8
B Programm für NokiaComunicator erstellen Android & Cross-Platform Mobile Apps 2
K Programme für Handy erstellen Android & Cross-Platform Mobile Apps 3
M Java-Programme für Handy auf Desktop-PC ausführen Android & Cross-Platform Mobile Apps 4
T Für Handy Game die Sprache umschreiben? Android & Cross-Platform Mobile Apps 24
M java game für handy mit grahi. oberfläche Android & Cross-Platform Mobile Apps 1
D java.security.MessageDigest (für ME?) Android & Cross-Platform Mobile Apps 1
N Unser Team such Coder für Spieleprojekte Android & Cross-Platform Mobile Apps 8
B WTK für Sony Ericsson? Android & Cross-Platform Mobile Apps 7
S JAVA für java-mobiltelefone Android & Cross-Platform Mobile Apps 14
W Reward Ads AdMob wird nicht ausgeliefert. Android & Cross-Platform Mobile Apps 9
O Google Admob Ad wird nicht geladen und App stürzt ab Android & Cross-Platform Mobile Apps 1
T Android AdMob Geld pro Klick oder Seitenaufruf? Android & Cross-Platform Mobile Apps 1
B AdMob im Projekt einbinden? Android & Cross-Platform Mobile Apps 3

Ähnliche Java Themen

Neue Themen


Oben