com.inmobi.sdk.InMobiSdk Java Examples

The following examples show how to use com.inmobi.sdk.InMobiSdk. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InMobiMediationAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 6 votes vote down vote up
@Override
public VersionInfo getSDKVersionInfo() {
  String versionString = InMobiSdk.getVersion();
  String[] splits = versionString.split("\\.");

  if (splits.length >= 3) {
    int major = Integer.parseInt(splits[0]);
    int minor = Integer.parseInt(splits[1]);
    int micro = Integer.parseInt(splits[2]);
    return new VersionInfo(major, minor, micro);
  }

  String logMessage = String.format("Unexpected SDK version format: %s." +
      "Returning 0.0.0 for SDK version.", versionString);
  Log.w(TAG, logMessage);
  return new VersionInfo(0, 0, 0);
}
 
Example #2
Source File: InMobiAdapterUtils.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
static void setGlobalTargeting(MediationAdRequest mediationAdRequest, Bundle extras) {
  configureGlobalTargeting(extras);

  if (mediationAdRequest.getLocation() != null) {
    InMobiSdk.setLocation(mediationAdRequest.getLocation());
  }

  // Date Of Birth
  if (mediationAdRequest.getBirthday() != null) {
    Calendar dob = Calendar.getInstance();
    dob.setTime(mediationAdRequest.getBirthday());
    InMobiSdk.setYearOfBirth(dob.get(Calendar.YEAR));
  }

  // Gender
  if (mediationAdRequest.getGender() != -1) {
    switch (mediationAdRequest.getGender()) {
      case AdRequest.GENDER_MALE:
        InMobiSdk.setGender(Gender.MALE);
        break;
      case AdRequest.GENDER_FEMALE:
        InMobiSdk.setGender(Gender.FEMALE);
        break;
      default:
        break;
    }
  }
}
 
Example #3
Source File: InMobiAdapterUtils.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
static void setGlobalTargeting(MediationRewardedAdConfiguration configuration, Bundle extras) {
  configureGlobalTargeting(extras);

  if (configuration.getLocation() != null) {
    InMobiSdk.setLocation(configuration.getLocation());
  }
}
 
Example #4
Source File: InMobiConsent.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
/**
 * Call InMobiConsent.updateGDPRConsent() to update GDPR consent for the user on each request
 * basis.
 */
public static void updateGDPRConsent(JSONObject consentObj) {
  if (InMobiAdapter.isSdkInitialized.get()) {
    InMobiSdk.updateGDPRConsent(consentObj);
  }
  InMobiConsent.consentObj = consentObj;
}
 
Example #5
Source File: InMobiBaseAdapterConfiguration.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void initializeNetwork(@NonNull Context context,
    @Nullable Map<String, String> configuration,
    @NonNull OnNetworkInitializationFinishedListener listener) {
  InMobiSdk.init(context, BuildConfig.MOPUB_INMOBI_ACCOUNT_ID);
}
 
Example #6
Source File: InMobiSettings.java    From mobile-sdk-android with Apache License 2.0 4 votes vote down vote up
public static void setInMobiAppId(String key, Context context) {
    INMOBI_APP_ID = key;
    if (!StringUtil.isEmpty(INMOBI_APP_ID)) {
        InMobiSdk.init(context, INMOBI_APP_ID);
    }
}
 
Example #7
Source File: InMobiSettings.java    From mobile-sdk-android with Apache License 2.0 4 votes vote down vote up
public static void setTargetingParams(TargetingParameters tp) {
    if (tp == null) return;
    switch (tp.getGender()) {
        case UNKNOWN:
            break;
        case MALE:
            InMobiSdk.setGender(InMobiSdk.Gender.MALE);
            break;
        case FEMALE:
            InMobiSdk.setGender(InMobiSdk.Gender.FEMALE);
            break;
    }
    if (tp.getAge() != null) {
        int age = 0;
        try {
            String age_string = tp.getAge();
            if (age_string.contains("-")) {
                int dash = age_string.indexOf("-");
                int age1 = Integer.parseInt(age_string.substring(0, dash));
                int age2 = Integer.parseInt(age_string.substring(dash + 1));
                age = (age1 + age2) / 2;
            } else {
                age = Integer.parseInt(tp.getAge());
                if (age > 1900) {
                    GregorianCalendar calendar = new GregorianCalendar();
                    Date date = new Date();
                    calendar.setTime(date);
                    int year = calendar.get(Calendar.YEAR);
                    age = year - age;
                }
            }
        } catch (NumberFormatException e) {
        } catch (IllegalArgumentException e1) {
        } catch (ArrayIndexOutOfBoundsException e2) {
        }
        if (age > 0) {
            InMobiSdk.setAge(age);
            if (age < 18) {
                InMobiSdk.setAgeGroup(InMobiSdk.AgeGroup.BELOW_18);
            } else if (age <= 24) {
                InMobiSdk.setAgeGroup(InMobiSdk.AgeGroup.BETWEEN_18_AND_24);
            } else if (age <= 29) {
                InMobiSdk.setAgeGroup(InMobiSdk.AgeGroup.BETWEEN_25_AND_29);
            } else if (age <= 34) {
                InMobiSdk.setAgeGroup(InMobiSdk.AgeGroup.BETWEEN_30_AND_34);
            } else if (age <= 44) {
                InMobiSdk.setAgeGroup(InMobiSdk.AgeGroup.BETWEEN_35_AND_44);
            }
            else if (age <= 54) {
                InMobiSdk.setAgeGroup(InMobiSdk.AgeGroup.BETWEEN_45_AND_54);
            }
            else if (age <= 64) {
                InMobiSdk.setAgeGroup(InMobiSdk.AgeGroup.BETWEEN_55_AND_65);
            }
            else{
                InMobiSdk.setAgeGroup(InMobiSdk.AgeGroup.ABOVE_65);
            }
        }
    }

    if (tp.getLocation() != null) {
        InMobiSdk.setLocation(tp.getLocation());
    }
}