Skip to content

Commit

Permalink
add firebase ads integrate
Browse files Browse the repository at this point in the history
  • Loading branch information
yeungeek committed May 23, 2016
1 parent 391594f commit 28b57f8
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle
Expand Up @@ -4,6 +4,7 @@ apply plugin: 'com.fernandocejas.frodo'
apply plugin: 'build-time-tracker'
apply plugin: 'bugly'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'com.google.gms.google-services'

apply from: '../config/quality/quality.gradle'
apply from: '../buildsystem/artifacts.gradle'
Expand Down Expand Up @@ -205,7 +206,7 @@ dependencies {
//analysis
compile analysisDependencies.buglyUpgrade

compile profitDependencies.playServicesAds
compile profitDependencies.fireBaseAds
// Test
testCompile injectDependencies.dagger
testCompile injectDependencies.javaxAnnotation
Expand Down
42 changes: 42 additions & 0 deletions app/google-services.json
@@ -0,0 +1,42 @@
{
"project_info": {
"project_number": "423857193954",
"firebase_url": "https://monkey-android-7aa77.firebaseio.com",
"project_id": "monkey-android-7aa77",
"storage_bucket": "monkey-android-7aa77.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:423857193954:android:540ddf433cc50b06",
"android_client_info": {
"package_name": "com.yeungeek.monkeyandroid"
}
},
"oauth_client": [
{
"client_id": "423857193954-99shkcq9omsambusgjo3den5pqsqtihb.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDuo6NGWj9m6C8Hx5Fd7qFc-puIiZBABoE"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
Expand Up @@ -25,9 +25,14 @@
import com.yeungeek.monkeyandroid.ui.base.view.BaseActivity;
import com.yeungeek.monkeyandroid.util.AppCst;

import java.util.concurrent.TimeUnit;

import javax.inject.Inject;

import butterknife.Bind;
import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;

/**
* Created by yeungeek on 2016/4/11.
Expand Down Expand Up @@ -76,8 +81,24 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
Glide.with(this).load(dataManager.getPreferencesHelper().getUserAvatar()).into(avatar);
}

initAds();

Observable.empty().delay(1000, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<Object>() {
@Override
public void onCompleted() {
initAds();
}

@Override
public void onError(Throwable e) {

}

@Override
public void onNext(Object o) {

}
});
}

private void initAds() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Expand Up @@ -44,5 +44,5 @@
<string name="title_about_desc">Monkey android is a GitHub third party client, show the rank of users and repositories,trending. Base on Material Design,use MVP pattern</string>

<!-- This is an ad unit ID for a test ad. Replace with your own banner ad unit id. -->
<!--<string name="banner_ad_unit_id">ca-app-pub-4106776683609657/2279239023</string>-->
<!--<string name="banner_ad_unit_id">ca-app-pub-4106776683609657/7826245024</string>-->
</resources>
2 changes: 2 additions & 0 deletions build.gradle
Expand Up @@ -15,6 +15,8 @@ buildscript {
classpath "net.rdrei.android.buildtimetracker:gradle-plugin:0.5.+"
classpath 'com.tencent.bugly:symtabfileuploader:1.3.9'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3'
//play
classpath 'com.google.gms:google-services:3.0.0'
}
}

Expand Down
5 changes: 3 additions & 2 deletions buildsystem/dependencies.gradle
Expand Up @@ -50,7 +50,7 @@ ext {
awesomeSplashVersion = "v1.0.0"

//ads
playServicesVersion = "8.4.0"
playServicesVersion = "9.0.0"

// Test Libs
junitVersion = '4.12'
Expand Down Expand Up @@ -120,6 +120,7 @@ ext {
]

profitDependencies = [
playServicesAds: "com.google.android.gms:play-services-ads:${playServicesVersion}"
playServicesAds: "com.google.android.gms:play-services-ads:${playServicesVersion}",
fireBaseAds: "com.google.firebase:firebase-ads:${playServicesVersion}"
]
}

0 comments on commit 28b57f8

Please sign in to comment.