PSP Dragon Emulator v1.0版本的 MD5 值为:c6379fb6b63c27b6a7d2f2f6f6f51637
以下内容为反编译后的 NotificationAdsCreator.java 源代码,内容仅作参考
package com.airpush.injector.internal;
import android.content.Context;
import android.os.Build;
import android.support.annotation.NonNull;
import com.airpush.AirPush;
import com.airpush.injector.internal.common.IntegrationValidator;
import com.airpush.injector.internal.common.exceptions.AdException;
import com.airpush.injector.internal.common.exceptions.AdInternalException;
import com.airpush.injector.internal.parser.ICreative;
import com.airpush.injector.internal.pushes.banner.BannerNotification;
import com.airpush.injector.internal.pushes.banner.BannerNotificationCreative;
import com.airpush.injector.internal.pushes.ico.center.CenterIcoNotification;
import com.airpush.injector.internal.pushes.ico.center.CenterIcoNotificationCreative;
import com.airpush.injector.internal.pushes.ico.left.LeftIcoNotification;
import com.airpush.injector.internal.pushes.ico.left.LeftIcoNotificationCreative;
import com.airpush.injector.internal.skeleton.AdRequest;
import com.airpush.injector.internal.skeleton.AdWithoutContainerCreator;
import com.airpush.injector.internal.skeleton.IAdRequest;
import com.facebook.appevents.AppEventsConstants;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
public class NotificationAdsCreator extends AdWithoutContainerCreator {
public NotificationAdsCreator(Context context) {
super(context);
}
@Override
public void show(ICreative iCreative) throws AdException {
if (iCreative instanceof BannerNotificationCreative) {
if (Build.VERSION.SDK_INT >= 16) {
new BannerNotification(this.ctx).show((BannerNotificationCreative) iCreative);
} else {
throw new AdInternalException("Device not support this type of notification. It must be shoved only on 16+ API version");
}
}
if (iCreative instanceof LeftIcoNotificationCreative) {
new LeftIcoNotification(this.ctx).show((LeftIcoNotificationCreative) iCreative);
}
if (iCreative instanceof CenterIcoNotificationCreative) {
new CenterIcoNotification(this.ctx).show((CenterIcoNotificationCreative) iCreative);
}
}
@Override
protected IAdRequest getAdRequest() {
return new AdRequest(this.ctx, AirPush.getApiKey(), AirPush.getAppId()) {
@Override
protected void addRequestBodyParams(HashMap<String, String> hashMap) {
hashMap.put("model", "message");
hashMap.put("action", "getmessage");
if (new IntegrationValidator(NotificationAdsCreator.this.ctx).validateNotificationsParameters()) {
hashMap.put("isXMLFound", "1");
} else {
hashMap.put("isXMLFound", AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
}
@Override
@NonNull
public URL getUrl() throws MalformedURLException {
return new URL("https://api.airpush.com/v2/api.php");
}
};
}
@Override
protected Class<? extends ICreative>[] getSupportedCreatives() {
return new Class[]{CenterIcoNotificationCreative.class, LeftIcoNotificationCreative.class, BannerNotificationCreative.class};
}
}