我根据admob网站的说明将所有内容添加到Android应用程序中。在模拟器和手机上我测试了我的应用程序。测试广告正确显示。我生成了一个签名的apk,但它仍然显示测试广告。我该怎么办? 在这里我的代码:
// First add ViewChild and Content imports
import { ViewChild, Component, ViewEncapsulation } from '@angular/core';
import { NavController, Content } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'pages/home/home.html',
styles: [`
.scroll-content {
display: flex;
flex-direction: column;
}
.scroll-content ion-list {
margin-top: auto;
margin-bottom: 0;
}
`],
encapsulation: ViewEncapsulation.None
})
export class HomePage {
@ViewChild(Content) content: Content; // <-- get a reference of the content
count = 4; // for demo
appName = 'Ionic App';
array = [
{ name: 'item-1' },
{ name: 'item-2' },
{ name: 'item-3' }
];
constructor(private navController: NavController) {
}
search() {
console.log('searching...');
}
add(number) {
let itemNumber = this.count;
this.array.push({ name: 'item-' + itemNumber });
this.scrollToBottom(); // <- when the new item is pushed, scroll to the bottom to show it
this.count += number;
}
scrollToBottom(){
// use the content's dimension to obtain the current height of the scroll
let dimension = this.content.getContentDimensions();
// scroll to it (you can also set the duration in ms by passing a third parameter to the scrollTo(x,y,duration) method.
this.content.scrollTo(0, dimension.scrollHeight);
}
}
MainActivity中的:
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
请帮助我!