IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

Intégrer une pub Admob


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Invité
    Invité(e)
    Par défaut Intégrer une pub Admob
    Bonjour
    j'ai trouvé un open source pour une application et après je lui ai ajouté divers élément, un widget et splashscreen.
    J'ai essayé de lui ajouté une pub Admob en xml (SDK4.3.1) et c'est là que ça coince.
    La bannière s'affiche correctement mais il y a un cadre avec écrit "You must have AdActivity declared in AndroidManifest.xml with ConfigChanges".
    J'ai regardé ce qu'il manquait à cette page: https://developers.google.com/mobile...d/fundamentals

    donc j'ai ajouté ces ligne dans le manifest :

    <activity android:name="com.google.ads.AdActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

    et maintenant la bannière n’apparaît même plus.
    Je suis confronté à ce problème depuis 2 semaines (mais je prend mon temps pour le faire).
    J'ai cherché sur Google et je ne trouve rien qui pourrait arrangé mon problème.
    De plus, je n'ai aucune erreur dans eclipse mis à part ces 2 lignes dans un icone "console":
    [2012-04-05 10:44:23 - SplashScreen] 'default' is not a best match for any device/locale combination.
    [2012-04-05 10:44:23 - SplashScreen] Displaying it with 'Locale Language ___Region __, sw320dp, w320dp, h533dp, Normal Screen, Long screen aspect ratio, Portrait Orientation, Normal, Day time, High Density, Finger-based touchscreen, Soft keyboard, No keyboard, Exposed navigation, Trackball navigation, Screen resolution 800x480, API Level 14' which is compatible, but will actually be displayed with another more specific version of the layout.

    je ne sais pas si cela à quelque chose à voir.
    Sinon mon application marche nickel.
    Si vous pouvez m'aider, ça serait génial.

  2. #2
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Par défaut
    Normalement c'est pas bien compliqué d'intégrer admob.
    Peux tu nous montré ton manifest.xml, ton layout où se trouve ta pub et eventuellement le bout de code java où tu initialises le bandeau d epub ?

    Merci

  3. #3
    Invité
    Invité(e)
    Par défaut
    merci de répondre déjà, j'apprécie vraiment

    voici le main:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:padding="10dp"
        android:background="@drawable/wallpaper2" >
     
        <com.google.ads.AdView android:id="@+id/adView"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             ads:adUnitId="j'ai bien remplacé l'id fournit par admob"
                             ads:adSize="BANNER"
                             ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
                             ads:loadAdOnCreate="true"/>
     
     
        <!-- this is the "bottom" layer -->
        <RelativeLayout
            android:layout_width="fill_parent"
    	    android:layout_height="fill_parent"
    	    android:layout_gravity="center">
     
     
    	    <SurfaceView
    	        android:id="@+id/camerapreview"
    	        android:layout_width="1dp"
    	        android:layout_height="1dp"
    	        android:layout_centerInParent="true" />
     
    	</RelativeLayout>
     
        <!-- this is the "top" layer, hiding the surface preview artifact above -->
        <RelativeLayout
            android:layout_width="fill_parent"
    	    android:layout_height="fill_parent"
    	    android:layout_gravity="center" >
     
    	    <ImageButton
    	        android:id="@+id/pressbutton"
    	        android:layout_width="wrap_content"
    	        android:layout_height="wrap_content"
    	        android:layout_centerInParent="true"
    	        android:background="@android:color/transparent"
    	        android:contentDescription="@string/pressme"
    	        android:src="@drawable/switch_button" />
     
    	</RelativeLayout>
     
    </FrameLayout>
    voici le manifest:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.neosis.androlight"
        android:versionCode="15"
        android:versionName="1.0"
        android:installLocation="auto">
     
        <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="15"/>
     
        <uses-permission android:name="android.permission.CAMERA"/>
        <uses-permission android:name="android.permission.FLASHLIGHT"/>
        <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
        <uses-permission android:name="android.permission.INTERNET"/>
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     
        <uses-feature android:name="android.hardware.camera"/>
        <uses-feature android:name="android.hardware.camera.flash"/>
     
        <application
            android:icon="@drawable/lightbulb_launcher"
            android:label="@string/app_name" >
             <activity android:name=".SplashScreen"
                      android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                      android:label="@string/app_name"
                      android:screenOrientation="portrait"
                      android:configChanges="orientation|keyboardHidden">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity
                android:name=".GalaxyTorchActivity"
                android:label="@string/app_name"
                android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                android:screenOrientation="portrait"
                android:configChanges="orientation|keyboardHidden" > 
                </activity>
            <receiver android:name=".GalaxyTorchWidgetProvider">
                <intent-filter>
                    <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                </intent-filter>
                <meta-data android:name="android.appwidget.provider" 
                           android:resource="@xml/torch_widget_info" />
            </receiver>
            <service android:name=".GalaxyTorchService">
                <!-- since (currently) we are only consuming this service locally, ignore
                <intent-filter>
                    <action android:name="com.swijaya.galaxytorch.toggle_action" />
                </intent-filter>
                -->
            </service>
             <activity android:name="com.google.ads.AdActivity"
                  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
        </application>
     
    </manifest>
    et je n'ai pas ajouté de code java.
    Dernière modification par Robin56 ; 05/04/2012 à 12h02. Motif: Utilisation de la balise [code][/code] (bouton #)

  4. #4
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Par défaut
    Essaye peut être ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:padding="10dp"
        android:background="@drawable/wallpaper2" >
     
    <com.google.ads.AdView android:id="@+id/adView"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             ads:adUnitId="j'ai bien remplacé l'id fournit par admob"
                             ads:adSize="BANNER"
                             ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
                             ads:loadAdOnCreate="true"/> 
     
    <FrameLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    >
     
     
     
        <!-- this is the "bottom" layer -->
        <RelativeLayout
            android:layout_width="fill_parent"
    	    android:layout_height="fill_parent"
    	    android:layout_gravity="center">
     
     
    	    <SurfaceView
    	        android:id="@+id/camerapreview"
    	        android:layout_width="1dp"
    	        android:layout_height="1dp"
    	        android:layout_centerInParent="true" />
     
    	</RelativeLayout>
     
        <!-- this is the "top" layer, hiding the surface preview artifact above -->
        <RelativeLayout
            android:layout_width="fill_parent"
    	    android:layout_height="fill_parent"
    	    android:layout_gravity="center" >
     
    	    <ImageButton
    	        android:id="@+id/pressbutton"
    	        android:layout_width="wrap_content"
    	        android:layout_height="wrap_content"
    	        android:layout_centerInParent="true"
    	        android:background="@android:color/transparent"
    	        android:contentDescription="@string/pressme"
    	        android:src="@drawable/switch_button" />
     
    	</RelativeLayout>
     
    </FrameLayout>
    </LinearLayout>
    Sinon depuis ton code Java tu peux récupéré la main sur ton composant pour afficher la pub et y mettre un listener. Ce listener te permettera de savoir ce qu'il se passe si il n'affiche toujours pas la pub.

  5. #5
    Invité
    Invité(e)
    Par défaut
    Je vais aller manger là. Je test après et je te dis si ça marche (ça ne vous dérange pas que je vous tutoie?)

  6. #6
    Invité
    Invité(e)
    Par défaut
    je viens d'essayer et je n'ai toujours aucune erreur dans eclipse mais la bannière ne s'affiche toujours pas.
    Pour le listener, je n'ai pas trop compris, je débute en développement à vrai dire ^^

    si je te colle le java, tu pourrais m'expliquer? je ne demandes qu'à apprendre de toute façon

    je peux même t'envoyer mon projet par mp si besoin est.

  7. #7
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Par défaut
    Si tu ne sais pas ce qu'est un listener, je te conseille vraiment de prendre un projet de la base (un Hello World) et de l'enrichir petit à petit pour comprendre comment on développe en Java & sur Android.
    Sans ses prérequis de base, ça va être très compliqués pour moi de t'aider si tu ne connais pas les rudiments du langages & de la plateforme.

Discussions similaires

  1. Réponses: 0
    Dernier message: 30/12/2008, 16h32
  2. Intégrer une page dans une autre
    Par sami_c dans le forum Balisage (X)HTML et validation W3C
    Réponses: 5
    Dernier message: 21/06/2005, 12h07
  3. Réponses: 5
    Dernier message: 01/12/2004, 16h37
  4. [TStringGrid] intégrer une ComboBox
    Par AnneOlga dans le forum C++Builder
    Réponses: 2
    Dernier message: 14/10/2004, 15h46
  5. Réponses: 6
    Dernier message: 30/08/2004, 15h48

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo