Airpush 広告で動作するアプリケーションを作成したいと考えています。以下の私のコードを見ることができますが、私は今完全に混乱しています..良い点は、私のアプリが実行されていることです。悪い点は、広告がないことです。誰かが理由を知っているか、正しいコードを知っていますか?
package com.syntaix.appleclicker;
import com.enkk.nrfk181061.AdListener.AdType;
import com.enkk.nrfk181061.*;
import com.enkk.nrfk181061.AdListener.BannerAdListener;
import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends ActionBarActivity implements BannerAdListener {
private Prm prm;
int counter = 10;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdView adView = new AdView(this, AdView.BANNER_TYPE_IN_APP_AD,
AdView.PLACEMENT_TYPE_INTERSTITIAL, false, false,
AdView.ANIMATION_TYPE_LEFT_TO_RIGHT);
adView.setAdListener(this);
if (prm == null)
prm = new Prm(this, adCallbackListener, false);
prm.runAppWall(); //this will start the AppWall ad but it will not show you AppWall instantly.
try {
prm.runCachedAd(this, AdType.appwall);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
final TextView text = (TextView) findViewById(R.id.TextView01);
final ImageView image = (ImageView) findViewById(R.id.appel);
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (counter > 0) {
counter--;
text.setText("" + counter);
}
if (counter == 0) {
text.setText("Finished");
}
}
});
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
AdListener adCallbackListener=new AdListener() {
@Override
public void onSDKIntegrationError(String message) {
//Here you will receive message from SDK if it detects any integration issue.
}
public void onSmartWallAdShowing() {
// This will be called by SDK when it’s showing any of the SmartWall ad.
}
@Override
public void onSmartWallAdClosed() {
// This will be called by SDK when the SmartWall ad is closed.
}
@Override
public void onAdError(String message) {
//This will get called if any error occurred during ad serving.
}
@Override
public void onAdCached(AdType arg0) {
//This will get called when an ad is cached.
}
@Override
public void noAdAvailableListener() {
//this will get called when ad is not available
}
};
AdListener.BannerAdListener adlistener = new AdListener.BannerAdListener() {
@Override
public void onAdClickListener()
{
//This will get called when ad is clicked.
}
@Override
public void onAdLoadedListener()
{
//This will get called when an ad has loaded.
}
@Override
public void onAdLoadingListener()
{
//This will get called when a rich media ad is loading.
}
@Override
public void onAdExpandedListner()
{
//This will get called when an ad is showing on a user's screen. This may cover the whole UI.
}
@Override
public void onCloseListener()
{
//This will get called when an ad is closing/resizing from an expanded state.
}
@Override
public void onErrorListener(String message)
{
//This will get called when any error has occurred. This will also get called if the SDK notices any integration mistakes.
}
@Override
public void noAdAvailableListener() {
//this will get called when ad is not available
}
};
@Override
public void onBackPressed() {
try{
prm.runCachedAd(this, AdType.smartwall); // for closing the activity call finish() method in onSmartWallClosed().
}catch (Exception e) { // close the activity if ad is not available.
//finish();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container,
false);
return rootView;
}
}
@Override
public void noAdAvailableListener() {
// TODO Auto-generated method stub
}
@Override
public void onAdClickListener() {
// TODO Auto-generated method stub
}
@Override
public void onAdExpandedListner() {
// TODO Auto-generated method stub
}
@Override
public void onAdLoadedListener() {
// TODO Auto-generated method stub
}
@Override
public void onAdLoadingListener() {
// TODO Auto-generated method stub
}
@Override
public void onCloseListener() {
// TODO Auto-generated method stub
}
@Override
public void onErrorListener(String arg0) {
// TODO Auto-generated method stub
}
}