diff --git a/app/src/main/java/com/otaupdater/AdsFragment.java b/app/src/main/java/com/otaupdater/AdsFragment.java index 1517fe0..adf99ca 100644 --- a/app/src/main/java/com/otaupdater/AdsFragment.java +++ b/app/src/main/java/com/otaupdater/AdsFragment.java @@ -23,6 +23,7 @@ import android.view.View; import android.view.ViewGroup; +import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.otaupdater.utils.Config; @@ -47,12 +48,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa View view = inflater.inflate(R.layout.ads, container, false); if (!this.isDetached()) { -// adView = (AdView) view.findViewById(R.id.ad_view); -// AdRequest adReq = new AdRequest.Builder() -// .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) -// .addTestDevice("A462D6D0A148B8607AC0EA1173E32B11") -// .build(); -// adView.loadAd(adReq); + adView = (AdView) view.findViewById(R.id.ad_view); + AdRequest adReq = new AdRequest.Builder() + .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) + .build(); + adView.loadAd(adReq); } return view; diff --git a/app/src/main/java/com/otaupdater/utils/Utils.java b/app/src/main/java/com/otaupdater/utils/Utils.java index 1b1d8e9..469a28b 100644 --- a/app/src/main/java/com/otaupdater/utils/Utils.java +++ b/app/src/main/java/com/otaupdater/utils/Utils.java @@ -279,7 +279,7 @@ public void onSuccess(String message, JSONObject respObj) { try { if (PropUtils.isRomOtaEnabled()) { RomInfo info = RomInfo.FACTORY.fromJSON(respObj.getJSONObject(RomInfo.KEY_NAME)); - if (info.isUpdate()) { + if (info != null && info.isUpdate()) { cfg.storeRomUpdate(info); if (cfg.getShowNotif()) { info.showUpdateNotif(ctx); @@ -294,7 +294,7 @@ public void onSuccess(String message, JSONObject respObj) { if (PropUtils.isKernelOtaEnabled()) { KernelInfo info = KernelInfo.FACTORY.fromJSON(respObj.getJSONObject(KernelInfo.KEY_NAME)); - if (info.isUpdate()) { + if (info != null && info.isUpdate()) { cfg.storeKernelUpdate(info); if (cfg.getShowNotif()) { info.showUpdateNotif(ctx); diff --git a/app/src/main/res/layout/ads.xml b/app/src/main/res/layout/ads.xml index 5197582..522c167 100644 --- a/app/src/main/res/layout/ads.xml +++ b/app/src/main/res/layout/ads.xml @@ -6,11 +6,11 @@ android:layout_width="wrap_content" android:layout_height="match_parent"> - - - - - - + - \ No newline at end of file +