Blah2014 / phonegap-inmobi-plugin

Phonegap/Cordova InMobi Native Interstitial Ad plugin
2 stars 3 forks source link

phonegap-inmobi-plugin

PayPal - The safer, easier way to pay online!

TraderHub - daily stock picks, market signals, stock picking service

This plugin provides an implementation of InMobi Native Interstitial Ad.

Supported platforms

Important!

Note: steps you should take.

  1. Install plutform (iOS, Android)
  2. Install InMobi SDK 4.x
  3. Add plugin (phonegap-inmobi-plugin)
  4. Replace "Insert InMobi property ID here" in two places with your siteID from InMobi property
  5. Build (iOS, Android)

Installation

Cordova CLI
cordova plugin add com.setlevel.inmobi

or

cordova plugin add https://github.com/Blah2014/phonegap-inmobi-plugin
Phonegap CLI
phonegap local plugin add https://github.com/Blah2014/phonegap-inmobi-plugin
plugman CLI
plugman --platform ios --project ./platforms/ios --plugin https://github.com/Blah2014/phonegap-inmobi-plugin

Usage

<script>
    InMobi.showAd();
</script>

Configuration

iOS

Adding the SDK to your Project

Download latest InMobi SDK for iOS

Drag and drop under Xcode project Libs folder from downloaded iOS SDK 4.x

Adding Frameworks

You will need to add some optional and mandatory frameworks to your Xcode project for the SDK to work correctly. The frameworks required to compile the InMobi SDK 4.x monetization library are given below:

Adding Frameworks If you use iOS 8, please add the NSLocationWhenInUseUsageDescription flag to your info.plist file.

Adding Additional Build Settings

Add the -ObjC flag to the Other Linker Flags. To do so, perform the below steps:

  1. Open your project in Xcode.
  2. Select Application Target > Build Settings.
  3. In the Search field, search for 'Other Linker Flags'.
  4. Add the -ObjC flag.

AddObjc

Insert InMobi property ID

In CDVInMobi.m replace "Insert InMobi property ID here" in two places with your siteID from InMobi property.

Android

Adding the SDK to your Project

Download latest InMobi SDK for Android

Configuration

Copy the InMobi-4.x.x.jar file to your project by performing the steps given below.

  1. Create a subdirectory named libs in the root directory of your project.
  2. Copy the InMobi-4.x.x.jar file into the libs directory.

To add the JAR files to your project, perform the following steps:

  1. Right-click your project from the Package Explorer tab.
  2. Select Properties.
  3. Select Java Build Path from the left navigation area.
  4. Select the Libraries tab from the main window.
  5. Click Add JARs...
  6. Select the InMobi-4.x.x.jar file that you copied earlier to the libs directory.
  7. Click OK to add the InMobi SDK to your Android project.
Manifest File Changes

Include the below within the <application> tag.

    <activity android:name="com.inmobi.androidsdk.IMBrowserActivity"
            android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:hardwareAccelerated="true" />

Include the below within the <manifest> tag.

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <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.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_LOGS" />
    <uses-permission android:name="android.permission.READ_CALENDAR"/>
    <uses-permission android:name="android.permission.WRITE_CALENDAR"/>
    <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
Insert InMobi property ID

In CDVInMobi.java replace "Insert InMobi property ID here" in two places with your siteID from InMobi property.