Mopub Android Wrapper

From POKKT DOCUMENTATION
(Redirected from Mopub android wrapper)
Jump to: navigation, search

Pokkt Integration to MoPub

Last Update: 4th October, 2017


Pokkt SDK version required: 6.2.1

MoPub SDK version used: 4.9.0

Download Latest Version MoPub Wrapper.

Download Latest Version MoPub Wrapper for Unity.


Step 1: Getting Started

The following instructions assume you have already integrated MoPub SDK into your application.


Step 2: Adding Your Application to Your Pokkt Publisher's Account

  • Create Account and log-in at https://www.pokkt.com
  • Add your application and get its application Id and Security key.

Step 3: Pokkt Integration

Dependencies

  • Add PokktSDK_v6.2.1.aar or PokktSDK_v6.2.1.jar to your project.
  • Download PokktMoPubCustomBanner, PokktMoPubCustomInterstitial and PokktMoPubCustomRewardedVideo from Pokkt site and place it under com.mopub.mobileads package in your project structure. OR Download our Wrapper jar and place in your project.

Manifest

Permissions Declarations

Add the following permissions to your project manifest

  1. Mandatory permissions.

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    • android.permission.INTERNET = Required for SDK communication with server.
    • android.permission.ACCESS_NETWORK_STATE = Required to detect changes in network, like if WIFI is available or not.
  2. Optional permissions.

    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    • android.permission.READ_PHONE_STATE = Required for creating unique identifier for you application based on the unique id of the device like IMEI.
    • android.permission.WAKE_LOCK = Required to prevent device from going into the sleep mode during video play.
    • android.permission.WRITE_EXTERNAL_STORAGE = Required to store media files related to ads in external SD card, if not provided we will use app cache folder to store media files, which will result in unnecessary increase in application’s size. It is recommended to ask for this permission as low end devices generally have less internally memory available.
    • android.permission.WRITE_CALENDAR = Some Ads create events in calendar.
    • android.permission.ACCESS_COARSE_LOCATION" = Some Ads show content based on user’s location.
    • android.permission.ACCESS_FINE_LOCATION = Some Ads show content based on user’s location.
    • android.permission.CALL_PHONE = Some Ads are interactive and they provide you a way to call directly from the content.
    • android.permission.SEND_SMS = Some Ads are interactive and they provide you a way to send message.
    • android.permission.VIBRATE = Some Ads provide haptic feedback, so as to maintain their behaviour we need this permission

Activity Declaration

Add the following activity in your AndroidManifest for Pokkt SDK integration.

<activity
   android:name="com.pokkt.sdk.userinterface.presenter.activity.PokktAdActivity"
   android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode||screenSize|smallestScreenSize"
   android:hardwareAccelerated="true"
   android:label=”Pokkt”
   android:screenOrientation="landscape"
   android:windowSoftInputMode="stateAlwaysHidden|adjustUnspecified"/>

You can change the android screenOrientation landscape to portrait of your choice, the way you want to display the ads.

Service Declaration

Add the following service in your AndroidManifest for receiving InApp notifications.

<service
   android:name="com.pokkt.sdk.notification.NotificationService"
   android:exported="false"
   android:label="PokktNotificationService"/>

Step 4: Adding a Custom Event

  1. Sign in to your MoPub account at https://app.mopub.com/account/login/
  2. Click Add a network under Networks tab.

    Mopub network andr.jpg

  3. Click Custom Native Network and set up the inventory against your app.
    Mopub custom net andr.jpg
  4. Provide the following details:
    • Custom Event Class:Enter the name of the custom event class.
      • For Rewarded Video: Enter com.mopub.mobileads.PokktMoPubCustomRewardedVideo
      • For Interstitial: Enter com.mopub.mobileads.PokktMoPubCustomInterstitial
      • For Banner: Enter com.mopub.mobileads.PokktMoPubCustomBanner
    • Title:Enter the name for the custom event. This is used in reporting and cannot be changed later.
    • Custom Event Class Data:Enter a JSON string as follows:

      {
      "POKKT_SCREEN_NAME":"Screen Created on Pokkt Dashboard",
      "POKKT_APP_ID":"Pokkt App Id",
      "POKKT_SEC_KEY":"Pokkt App Security Key",
      "POKKT_THIRD_PARTY_USERID":"Unique user id as in your app",
      "POKKT_REWARD_NAME":"Virtual currency As per your App",
      "POKKT_DEBUG":true/false
      }
  5. Click Save Section.
  6. Open Global segment and enable the newly created Ad Network against the ad units of your app.

    Mopub segment andr.jpg

Step 5: Testing your application

Congratulation - that's it! You may now run your app and see Pokkt ads in action.