2014-02-14 3 views
0

제목에서 애플리케이션에서 admob 삽입 광고에 대한 코드를 제거하려면 어떻게해야합니까? 여기에 interstitial 코드가있는 activity.java 코드가 있습니다. 제거하고 다른 회사의 광고를 추가하려고합니다. 코딩 기술이나 경험이 없기 때문에 무언가를 망칠 수도 있습니다. Activity에 대한이 코드에서 admob의 삽입 광고를 어떻게 제거 할 수 있습니까?

코드 : 여기

package com.package.example; 
    import java.io.IOException; 
    import android.media.MediaPlayer; 
    import android.os.Bundle; 
    import android.annotation.SuppressLint; 
    import android.app.Activity; 
    import android.content.res.AssetFileDescriptor; 
    import android.util.Log; 
    import android.view.KeyEvent; 
    import android.webkit.WebChromeClient; 
    import android.webkit.WebView; 
    import com.google.analytics.tracking.android.EasyTracker; 
    import com.google.ads.*; 
    import com.google.ads.AdRequest.ErrorCode; 
    import com.kareem.Cairokee2014.R; 

    @SuppressLint({ "SetJavaScriptEnabled", "JavascriptInterface" }) 
    public class activity extends Activity implements AdListener { 
    public MediaPlayer player = new MediaPlayer(); 
    public WebView webView; 
    AssetFileDescriptor afd = null; 
    private InterstitialAd interstitial; 

    public void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

    // Create the interstitial 
     interstitial = new InterstitialAd(this, "1234567890"); 

     // Create ad request 
     AdRequest adRequest = new AdRequest(); 

     // Begin loading your interstitial 
     interstitial.loadAd(adRequest); 

     // Set Ad Listener to use the callbacks below 
     interstitial.setAdListener(this); 

     this.webView = ((WebView)findViewById(R.id.webView)); 
     this.webView.getSettings().setJavaScriptEnabled(true); 
     this.webView.setWebChromeClient(new WebChromeClient()); 
     this.webView.addJavascriptInterface(this, "activity"); 
     this.webView.loadUrl("file:///android_asset/index.html"); 
     } 

    @Override 
    public void onReceiveAd(Ad ad) { 
    Log.d("OK", "Received ad"); 
    if (ad == interstitial) { 
     interstitial.show(); 
    } 
    } 

    @Override 
    public void onStart() { 
    super.onStart(); 
    EasyTracker.getInstance().activityStart(this); // Add this method. 
    } 

    @Override 
    public void onStop() { 
    super.onStop(); 
    EasyTracker.getInstance().activityStop(this); // Add this method. 
    } 

    int lastfile; 
    public void play(int n) { 
     if (lastfile != n && lastfile >= 1) { 
      player.stop(); 
      player = new MediaPlayer(); 
     } 
     lastfile = n; 
     try { 
      afd = getAssets().openFd("source/"+n+".mp3"); 
     } catch (IOException e) { 
      e.printStackTrace(); 
     } 
     try { 
      player.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength()); 
     } catch (IllegalArgumentException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } catch (IllegalStateException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } catch (IOException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     try { 
      player.prepare(); 
     } catch (IllegalStateException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } catch (IOException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     if (!player.isPlaying()) 
     player.start(); 
    } 

    public void pause() { 
     if (player.isPlaying()) 
     player.pause(); 
    } 

    public void stop() { 
     player.stop(); 
     player = new MediaPlayer(); 
    } 

    @Override 
    public void onDismissScreen(Ad arg0) { 
     // TODO Auto-generated method stub 
    } 

    @Override 
    public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) { 
     // TODO Auto-generated method stub 
    } 

    @Override 
    public void onLeaveApplication(Ad arg0) { 
     // TODO Auto-generated method stub 
    } 

    @Override 
    public void onPresentScreen(Ad arg0) { 
     // TODO Auto-generated method stub 
     } 

    @Override 
     public boolean onKeyDown(int keyCode, KeyEvent event) { 
      if(event.getAction() == KeyEvent.ACTION_DOWN){ 
       switch(keyCode) 
       { 
       case KeyEvent.KEYCODE_BACK: 
        if(webView.canGoBack() == true){ 
         webView.goBack(); 
        }else{ 
         finish(); 
        } 
        return true; 
       } 
      } 
      return super.onKeyDown(keyCode, event); 
     } 

꽤 곧장 앞으로 보인다 난 당신이 내가

<?xml version="1.0" encoding="utf-8"?> 
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.kareem.Cairokee2014" 
    android:versionCode="1" 
    android:versionName="1" > 

<uses-sdk 
    android:minSdkVersion="8" 
    android:targetSdkVersion="19" /> 
<supports-screens android:smallScreens="true" 
android:normalScreens="true" android:largeScreens="true" 
android:anyDensity="true" /> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" 
    android:hardwareAccelerated="true"> 

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

    <activity 
     android:name="com.kareem.Cairokee2014.activity" 
     android:label="@string/app_name" 
     android:hardwareAccelerated="true" 
     android:theme="@android:style/Theme.Black.NoTitleBar" 
          android:screenOrientation="portrait" 
         > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 
</manifest> 

답변

2

을 삭제해야한다고 말했다 부분을 찾을 수 없습니다 AndroidManifest입니다. 삭제 :

private InterstitialAd interstitial; 

// Create the interstitial 
    interstitial = new InterstitialAd(this, "1234567890"); 

    // Create ad request 
    AdRequest adRequest = new AdRequest(); 

    // Begin loading your interstitial 
    interstitial.loadAd(adRequest); 

    // Set Ad Listener to use the callbacks below 
    interstitial.setAdListener(this); 

@Override 
public void onReceiveAd(Ad ad) { 
Log.d("OK", "Received ad"); 
if (ad == interstitial) { 
    interstitial.show(); 
} 
} 

Manifest.xml에서 다음을 제거합니다

<meta-data 
     android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version" /> 
<activity 
     android:name="com.google.android.gms.ads.AdActivity" 
     android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> 
+0

는 수입 또는 Ctrl + 일식에서 Shift + O를 삭제합니다. 또한 매니페스트에서 몇 가지를 제거해야합니다. –

+0

질문에 내 매니페스트 코드를 추가 했으므로 답변에 넣은 부분을 찾지 못했습니다. ctrl + shift + o를 눌러 모두 삭제하지만 앱 또는 삽입 광고와 관련이없는 경우 "가져 오기 삭제"가 의미하는 것은 무엇입니까? 또한 내가 갖고 싶어하는 앱에 배너 광고가 있습니다. 괜찮습니까? 아니면 배너 광고를 제거할까요? 나는 수입이 분석과 배너 광고와 관련이 있다고 생각한다. 도와 주셔서 감사합니다. – Kareem

+0

다른 광고를 계속 표시하는 경우 매니페스트 코드를 유지해야 할 수 있습니다. –

관련 문제