Difference between revisions of "IOS"

From Ad4Game Developers
Jump to: navigation, search
(Created page with "= <font color='green'>Publishers</font> = == <font color='#2D95DB'>Download Android SDK</font> == Download the [[http://ad4gamewiki.local/download/Android/Pub_AndroidSDK_2.0.z...")
 
(Display iOS Editorials)
 
(68 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
<br><img>http://developer.ad4game.com/images/ios.jpg</img>
 
= <font color='green'>Publishers</font> =
 
= <font color='green'>Publishers</font> =
== <font color='#2D95DB'>Download Android SDK</font> ==
+
== <font color='#2D95DB'>Download iOS SDK</font> ==
Download the [[http://ad4gamewiki.local/download/Android/Pub_AndroidSDK_2.0.zip Android SDK for publishers]]. Decompress the zip file and extract the files to your development computer.  
+
Download the [[http://developer.ad4game.com/download/iOS/Pub_IOS_SDK_3.0.zip iOS SDKv3.0 for publishers]]. Decompress the zip file and extract the files to your development mac.
<br>The Android SDK is provided as a single java JAR file ('''AndroidSDKPublisher.jar'''), making it easy to include in your Android project.
+
<br>The Ad4game iOS SDK is provided as a single framework file ('''A4GPub.framework'''), making it easy to include in your iOS project.
  
== <font color='#2D95DB'>Configure AndroidManifest.xml</font> ==
+
== <font color='#2D95DB'>Include the A4GPub.framework</font> ==
The SDK requires the following permissions. Put these in before closing the manifest tag.
+
To include the A4GPub.framework to your xcode project, you need to select your target project, and then go to '''Build Phases → Link Binary With Libraries''',
<br><br>'''Internet Permission (Mandatory):'''  
+
<br>then click on the '''+''' sign  → '''Add Other''', and select the A4GPub.framework saved on your mac as shown below:
<br>The Internet permission is required to connect to publishing servers.
+
<br><img>http://developer.ad4game.com/download/iOS/A4GPubFramework.png</img>
<br><br><<font color='green'>uses-­permission</font> <font color='magenta'>android:name</font>="<font color='blue'>android.permission.INTERNET</font>"/>
+
 
<br><br>'''Wifi State Permission (Recommended):'''  
+
== <font color='#2D95DB'>Include the AdSupport.framework</font> ==
<br>This permission enable the SDK to access information about whether you are connected to a Wi­Fi network and obtain the device’s MAC address.
+
You need to include the '''AdSupport.framework''' to your project target to enable the Advertiser Identifier functionality.
<br><br><<font color='green'>uses-­permission</font> <font color='magenta'>android:name</font>="<font color='blue'>android.permission.ACCESS_WIFI_STATE</font>" />
+
<br>Go to '''Build Phases → Link Binary With Libraries''', then click on the '''+''' sign to add the AdSupport.framework as shown below:
<br><br>'''Connection Type Permission (Recommended):'''  
+
<br><img>http://developer.ad4game.com/download/iOS/AdSupport.png</img>
<br>This permission enable the SDK to detect if you are connected from a Wi­Fi network or 3G network.
+
<br>Then, change the value of AdSupport.framework from Required to '''Optional'''.
<br><br><<font color='green'>uses­-permission</font> <font color='magenta'>android:name</font>="<font color='blue'>android.permission.ACCESS_NETWORK_STATE</font>" />
+
 
<br><br>'''Tasks Permission (Mandatory):'''  
+
== <font color='#2D95DB'>Include the SystemConfiguration.framework</font> ==
<br>Allows the SDK to get information about the currently or recently running tasks to set the refresh value.  
+
You need to include the '''SystemConfiguration.framework''' to your project target to enable detection of the connection type.
<br><br><<font color='green'>uses­-permission</font> <font color='magenta'>android:name</font>="<font color='blue'>android.permission.GET_TASKS</font>" />
+
Go to '''Build Phases → Link Binary With Libraries''', then click on the '''+''' sign to add the SystemConfiguration.framework.
<br><br>'''Unique Device Identifier (Mandatory):'''
+
 
<br>Allows the SDK to get a unique id per device. Put these lines before closing the application tag.
+
== <font color='#2D95DB'>Include the QuartzCore.framework</font> ==
<br><br>
+
You need to include the '''QuartzCore.framework''' to your project target to customize the interface.
    <font color='green'><application ...></font>
+
<br>Go to '''Build Phases → Link Binary With Libraries''', then click on the '''+''' sign to add the QuartzCore.framework.
    <font color='green'><activity ...></font>
+
      ...
+
    <font color='green'></activity></font>
+
          <font color='green'><service</font> <font color='magenta'>android:name=</font><font color='blue'>"org.openudid.A4GOpenUDID_service"</font>>
+
          <font color='green'><intent-filter></font>
+
          <font color='green'><action</font> <font color='magenta'>android:name</font>=<font color='blue'>"org.openudid.GETUDID"</font> />
+
          <font color='green'></intent-filter></font>
+
          <font color='green'></service></font>
+
    <font color='green'></application></font>
+
  
== <font color='#2D95DB'>Install the Android SDK</font> ==
 
Add '''AndroidSDKPublisher.jar''' to your Android project's build path.
 
<br>If you are using Eclipse, right click on your '''project folder ­> Properties ­> Java Build Path ­> Libraries ­> Add JARs'''.
 
<br>(As of ADT 17.0, you can simply place '''AndroidSDKPublisher.jar''' in a folder called “libs” in your project directory and Eclipse will automatically include the jar as part of the build under the classpath container “Android Dependencies”) .
 
 
== <font color='#2D95DB'>Display Mobile Ads</font> ==
 
== <font color='#2D95DB'>Display Mobile Ads</font> ==
To display mobile ads inside your android application, you need to set the value of <font color='blue'>"refresh"</font> variable to refresh banners.
+
To display ads on your iOS project, you need to follow the steps bellow:
<br>You'll then need to instantiate the A4GPublisher class to allow you to call the functions from the AndroidSDKPublisher.  
+
<br>In your '''ViewController.xib'''
<br>Generally, the code is placed inside your main activity’s onCreate(Bundle) method.  
+
<br>– You need to add an '''UIImageView''' with the size of the ad.
<br>You will need to pass the layout ID  to the '''findViewById''' method, and then call '''loadZoneId'''(“'''ZoneID'''”) method.
+
<br>– You need to add an '''UIButton''' above the UIImageView with the same size of the ad.
      <br><br><font color='magenta'>public class</font> MyClass <font color='magenta'>extends</font> Activity {
+
<br>Connect the UIImageView and the UIButton to your ViewController.h file.
      <br><dd><font color='magenta'>public static int</font> <font color='blue'>refresh</font> = 30000; <font color='green'>//30 seconds</font>
+
<br><br>In your '''ViewController.h''' file
      <br><font color='#676A6C'>@Override</font>
+
<br>– You need to import the A4GPub.framework.
      <br><font color='magenta'>protected void</font> onCreate(Bundle savedInstanceState) {
+
<br>– Declare an Object of A4GPubViewController.
      <br><dd><font color='magenta'>super</font>.onCreate(savedInstanceState);
+
<br>Your code need to be similar to this:
      <br>setContentView(R.layout.<font color='blue'>activity_a4g</font>);
+
    <dd><font color='brown'>#import</font> <font color='red'><A4GPub/A4GPubViewController.h></font>
      <br>A4GPublisher widget = (A4GPublisher) findViewById(R.id.<font color='blue'>yourLayoutID</font>);
+
    <font color='magenta'>@interface</font> TestViewController : <font color='#9A2EFE'>UIViewController</font> {
      <br>widget.loadZoneId("<font color='blue'>ZoneID</font>");
+
    <font color='magenta'>IBOutlet</font> <font color='magenta'>UIImageView</font> *image;
      <br>}
+
    <font color='#9A2EFE'>A4GPubViewController</font> *a4g;
      <br>}
+
    }
 +
    - (<font color='magenta'>IBAction</font>)button : (<font color='magenta'>id</font>)sender;
 +
    <font color='magenta'>@end</font>
 +
In your '''ViewController.m''' file
 +
<br>You need to import the A4GPub.framework.
 +
<br>– In your '''viewDidLoad''' method, you need to instantiate the object created on viewController.h file and call the different method to display ads.
 +
<br>The methods are:
 +
<br>'''* setZoneID''' method allows you to set the zoneID.
 +
<br>'''* setImageView''' method allows you to set your UIImageView.
 +
<br>'''* getRefresh''' method to refresh the display of banners.
 +
<br>'''* loadAds''' method to get banners from ad4game servers.
 +
<br><br>Your code need to be similar to this:
 +
    <dd><font color='magenta'>#import</font> <font color='red'><A4GPub/A4GPubViewController.h></font>
 +
    <font color='magenta'>@implementation</font> TestViewController
 +
    –
 +
    (<font color='magenta'>void</font>)viewDidLoad
 +
    {
 +
      [<font color='magenta'>super</font> <font color='#9A2EFE'>viewDidLoad</font>];
 +
      <font color='green'>a4g</font> = [[<font color='#9A2EFE'>A4GPubViewController</font> alloc] init];
 +
      [<font color='green'>a4g</font> <font color='#9A2EFE'>setZoneID</font> : @"yourZoneID"];
 +
      [<font color='green'>a4g</font> <font color='#9A2EFE'>setImageView</font> : yourUIImageView]; <font color='green'>//in this example, its name is image</font>
 +
      [<font color='green'>a4g</font> <font color='#9A2EFE'>getRefresh</font>];
 +
      [<font color='green'>a4g</font> <font color='#9A2EFE'>loadAds</font>];
 +
    }
 +
– In your ­ '''(IBAction)button : (id)sender''' method, you need to call the '''loadClick''' method allowing you to get the click associate to the ad displayed.
 +
    <dd>– (<font color='magenta'>IBAction</font>)button : (<font color='magenta'>id</font>)sender
 +
  {
 +
    [<font color='green'>a4g</font> <font color='#9A2EFE'>loadClick</font>];
 +
  }
 +
 
 +
  <dd><font color='red'>'''Note:'''</font> You can add many zones as you want, just instantiate the A4GPubViewController object as follow :
 +
 
 +
In your '''ViewController.h''' :
 +
  <dd><font color='brown'>#import</font> <font color='red'><A4GPub/A4GPubViewController.h></font>
 +
  <font color='magenta'>@interface</font> TestViewController : <font color='#9A2EFE'>UIViewController</font> {
 +
    <font color='magenta'>IBOutlet</font> <font color='#9A2EFE'>UIImageView</font> *imageOne;
 +
    <font color='magenta'>IBOutlet</font> <font color='#9A2EFE'>UIImageView</font> *imagetwo;
 +
    <font color='#9A2EFE'>A4GPubViewController</font> *a4gObject;
 +
    <font color='#9A2EFE'>A4GPubViewController</font> *secondObject;
 +
  }
 +
  – (<font color='magenta'>IBAction</font>)buttonOne : (<font color='magenta'>id</font>)sender;
 +
  – (<font color='magenta'>IBAction</font>)buttonTwo : (<font color='magenta'>id</font>)sender;
 +
  <font color='magenta'>@end</font>
 +
 
 +
In your '''ViewController.m''' :
 +
    <dd><font color='brown'>#import</font> <font color='red'><A4GPub/A4GPubViewController.h></font>
 +
    <font color='magenta'>@implementation</font> TestViewController
 +
    -(<font color='magenta'>void</font>)viewDidLoad
 +
    {
 +
    [<font color='magenta'>super</font> <font color='#9A2EFE'>viewDidLoad</font>];
 +
    <font color='green'>a4gObject</font> = [[<font color='#9A2EFE'>A4GPubViewController</font> alloc] init];
 +
    <font color='green'>secondObject</font> = [[<font color='#9A2EFE'>A4GPubViewController</font> alloc] init];
 +
    [<font color='green'>a4gObject</font> <font color='#9A2EFE'>setZoneID</font> : @"FirstZoneID"];
 +
    [<font color='green'>a4gObject</font> <font color='#9A2EFE'>setImageView</font> : yourUIImageView];
 +
    [<font color='green'>a4gObject</font> <font color='#9A2EFE'>getRefresh</font>];
 +
    [<font color='green'>a4gObject</font> <font color='#9A2EFE'>loadAds</font>];
 +
    [<font color='green'>secondObject</font> <font color='#9A2EFE'>setZoneID</font> : @"SecondZoneID"];
 +
    [<font color='green'>secondObject</font> <font color='#9A2EFE'>setImageView</font> : yourUIImageView];
 +
    [<font color='green'>secondObject</font> <font color='#9A2EFE'>getRefresh</font>];
 +
    [<font color='green'>secondObject</font> <font color='#9A2EFE'>loadAds</font>];
 +
  }
 +
  – (<font color='magenta'>IBAction</font>)buttonOne : (<font color='magenta'>id</font>)sender
 +
  {
 +
    [<font color='green'>a4gObject</font> <font color='#9A2EFE'>loadClick</font>];
 +
  }
 +
  – (<font color='magenta'>IBAction</font>)buttonTwo : (<font color='magenta'>id</font>)sender
 +
  {
 +
    [<font color='green'>secondObject</font> <font color='#9A2EFE'>loadClick</font>];
 +
  }
 +
== <font color='#2D95DB'>Display iOS Editorials</font> ==
 +
To display iOS Editorials on your iOS project, you need to follow the steps bellow:
 +
<br><br>In your '''ViewController.xib'''
 +
<br>You need to add a '''UIButton''' if you want to launch the editorials when the user clicks on that button.
 +
<br>Connect the UIButton to your ViewController.h file.
 +
<br><br>In your '''ViewController.h''' file
 +
<br>– You need to import the '''A4GEdito.h''' header file.
 +
<br>– Declare an Object of A4GEdito.
 +
<br>Your code need to be similar to this:
 +
  <dd><font color='brown'>#import</font> <font color='red'><A4GPub/A4GEdito.h></font>
 +
  <font color='magenta'>@interface</font> TestViewController : <font color='#9A2EFE'>UIViewController</font> {
 +
    <font color='magenta'>IBOutlet</font> <font color='#9A2EFE'>UIButton</font> *editoButton;
 +
    <font color='#9A2EFE'>A4GEdito</font> *a4gEdito;
 +
  }
 +
  <font color='magenta'>@end</font>
 +
 
 +
In your '''ViewController.m''' file
 +
<br>– In your '''viewDidLoad''' method, you need to instantiate the object created on your ViewController.h file and call the different method to display Editorials.
 +
<br>The methods are:
 +
<br>'''* setZoneID''' method, allows you to set the zoneID.
 +
<br>* '''setButton''' method, allows you to set your UIButton.
 +
<br>'''* showA4GEditos''' method, to display directly the Editorials when the app started.
 +
<br>'''* showA4GEditosWithStartTime''' method, to display the Editorials after a certain time.
 +
<br>'''* showA4GEditosWithStartAndEndTime''' method, to display the Editorials after a certain time, and close them automatically after a certain time.
 +
<br><br>Your code need to be similar to this:
 +
 
 +
    <dd><font color='magenta'>@implementation</font> TestViewController
 +
    –(<font color='magenta'>void</font>)viewDidLoad
 +
    {
 +
    [<font color='magenta'>super</font> <font color='#9A2EFE'>viewDidLoad</font>];
 +
    <font color='green'>a4gEdito</font> = [[<font color='#9A2EFE'>A4GEdito</font> alloc] init];
 +
    [<font color='green'>a4gEdito</font> <font color='#9A2EFE'>setZoneID</font> : @"yourZoneID"];
 +
    [<font color='green'>a4gEdito</font> <font color='#9A2EFE'>setButton</font> : yourUIButton]; <font color='green'>//in this example, its name is editoButton</font>.
 +
    [[<font color='green'>a4gEdito</font> <font color='#9A2EFE'>getButton</font>] <font color='#9A2EFE'>addTarget</font> : <font color='green'>a4gEdito</font> <font color='#9A2EFE'>action</font> : <font color='red'>@selector</font>(<font color='#9A2EFE'>showA4GEditos</font>) <font color='#9A2EFE'>forControlEvents:UIControlEventTouchUpInside</font>];
 +
    <font color='green'> //this line add “showA4GEditos” action to your UIButton</font>.
 +
    [<font color='green'>a4gEdito</font> <font color='#9A2EFE'>showA4GEditos</font>]; <font color='green'>//Display Editorials directly when the app started</font>.
 +
    [<font color='green'>a4gEdito</font> <font color='#9A2EFE'>showA4GEditosWithStartTime</font>:<font color='blue'>15</font>]; <font color='green'>//Display Editorials after 15 seconds</font>.
 +
    [<font color='green'>a4gEdito</font> <font color='#9A2EFE'>showA4GEditosWithStartAndEndTime</font> : <font color='blue'>10</font> <font color='#9A2EFE'>withArg2</font> : <font color='blue'>30</font>]; <font color='green'>//Display Editorials after 10 seconds and close it automatically after 30 seconds</font>.
 +
    }
 +
== <font color='#2D95DB'>Display iOS Interstitials</font> ==
 +
To display iOS Interstitials on your iOS project, you need to follow the steps bellow:
 +
<br>In your '''ViewController.h''' file
 +
<br>- You need to import the '''A4GInterstitials.h''' header file.
 +
<br>- Declare an Object of A4GInterstitials.
 +
<br>Your code need to be similar to this:
 +
  <dd><font color='brown'>#import</font> <font color='red'><A4GPub/A4GInterstitials.h></font>
 +
  <font color='magenta'>@interface</font> TestViewController : <font color='#9A2EFE'>UIViewController</font> {
 +
    <font color='#9A2EFE'>A4GInterstitials</font> *a4gInter;
 +
  }
 +
  <font color='magenta'>@end</font>
 +
 
 +
'''In your ViewController.m file'''
 +
 
 +
- In your '''viewDidLoad''' method, you need to instantiate the object created on your ViewController.h file and call the differents method to display Interstitials.
 +
<br>The methods are:
 +
 
 +
<br>'''* setZoneID''' method, allows you to set the zoneID.
 +
<br>'''* showA4GInterstitials''' method, to display directly the Interstitials when the  app started.
 +
<br>'''* showA4GInterstitialsWithStartTime''' method, to display the interstitials after a certain time.
 +
<br>'''* showA4GInterstitialsWithStartAndEndTime''' method, to display the interstitials after a certain time, and close them automatically after a certain time.
 +
<br>Your code need to be similar to this:
 +
 
 +
  <dd><font color='magenta'>@implementation</font> TestViewController
 +
    –(<font color='magenta'>void</font>)viewDidLoad
 +
    {
 +
    [<font color='magenta'>super</font> <font color='#9A2EFE'>viewDidLoad</font>];
 +
    <font color='green'>a4gInter</font> = [[<font color='#9A2EFE'>A4GInterstitials</font> alloc] init];
 +
    [<font color='green'>a4gInter</font> <font color='#9A2EFE'>setZoneID</font> : @"yourZoneID"];
 +
    [<font color='green'>a4gInter</font> <font color='#9A2EFE'>showA4GInterstitials</font>]; <font color='green' size=1>//Display Interstitials directly when the app started</font>.
 +
    [<font color='green'>a4gInter</font> <font color='#9A2EFE'>showA4GInterstitialsWithStartTime</font>:<font color='blue'>15</font>]; <font color='green' size=1>//Display Interstitials after 15 seconds</font>.
 +
    [<font color='green'>a4gInter</font> <font color='#9A2EFE'>showA4GInterstitialsWithStartAndEndTime</font> : <font color='blue'>10</font> <font color='#9A2EFE'>withArg2</font> : <font color='blue'>30</font>]; <font color='green' size=1>//Display Interstitials after 10 seconds and close them automatically after 30 seconds</font>.
 +
    }
 +
 
 +
= <font color='green'>Advertisers</font> =
 +
== <font color='#2D95DB'>Download iOS SDK</font> ==
 +
Download the [[http://developer.ad4game.com/download/iOS/Track_IOS_SDK_1.0.zip iOS SDKv1.0 for advertisers]]. Decompress the zip file and extract the files to your development mac.
 +
<br>The Ad4game iOS SDK is provided as a single framework file ('''A4GTrack.framework'''), making it easy to include in your iOS project.
 +
 
 +
== <font color='#2D95DB'>Include the A4GTrack.framework</font> ==
 +
To include the A4GTrack.framework to your xcode project, you need to select your target project, and then go to '''Build Phases → Link Binary With Libraries''', then
 +
click on the '''+''' sign  '''→ Add Other''', and select the A4GTrack.framework saved on your mac as shown below:
 +
<br><img>http://developer.ad4game.com/download/iOS/A4GFramework.png</img>
 +
 
 +
== <font color='#2D95DB'>Include the AdSupport.framework</font> ==
 +
You need to include the AdSupport.framework to your project target to enable the Advertiser Identifier functionality.
 +
<br>Go to '''Build Phases → Link Binary With Libraries''', then click on the '''+''' sign to add the AdSupport.framework as shown below:
 +
<br><img>http://developer.ad4game.com/download/iOS/AdSupport.png</img>
 +
<br>Then, change the value of AdSupport.framework from Required to '''Optional'''.
  
<br>In your '''layout.xml''' file, you need to include the properties of the layout where you want to display the banners as follows
+
== <font color='#2D95DB'>Include the SystemConfiguration.framework</font> ==
 +
You need to include the '''SystemConfiguration.framework''' to your project target to enable detection of the internet availability.
 +
<br>Go to '''Build Phases → Link Binary With Libraries''', then click on the '''+''' sign to add the SystemConfiguration.framework.
 +
== <font color='#2D95DB'>Tracking installations</font> ==
 +
In your '''appDelegate.m''', you need to import the '''A4GTrack.framework'''
 +
<br><font color='brown'>#import</font> <font color='brown'><A4GTrack/A4GTrackViewController.h></font>
 +
<br>In your '''didFinishLaunchingWithOptions''' method, you need to call the '''trackInstall''' method thatallow you tracking installations once per user.
 +
<br>[ <font color='#9A2EFE'>A4GTrackViewController</font> <font color='blue'>trackInstall</font>:<font color='red'>@"yourTrackerID"</font>].
 +
= <font color='#2D95DB'>Contact</font> =
  
<br><font color='green'><com.a4gpublisher.A4GPublisher</font>
+
If you've got questions, we've got answers!
<br><font color='magenta'>android:id</font>=<font color='blue'>"@+id/yourLayoutID"</font>
+
Please Contact Us at <font color='blue'>tech@ad4game.com</font> with any technical queries.
<br><font color='magenta'>android:id</font>=<font color='blue'>"@+id/yourLayoutID"</font>
+
<br><font color='magenta'>android:layout_width</font>=<font color='blue'>"350dp"</font>
+
<br><font color='magenta'>android:layout_height</font>=<font color='blue'>"250dp"</font>
+
<br>...
+
<br><font color='green'>/></font>
+
<br><br><font color='red'>Note:</font> You can add many zones as you want, just instantiate the A4GPublisher object to create many widgets.
+
<br><br><font color='red'>Example:</font>
+
    <br>A4GPublisher <font color='#676A6C'>widget1</font> = (A4GPublisher) findViewById(R.id.<font color='blue'>yourFirstLayoutID</font>);
+
    <br><font color='#676A6C'>widget1</font>.loadZoneId("<font color='blue'>ZoneID</font>");
+
    <br><br>A4GPublisher <font color='#676A6C'>widget2</font> = (A4GPublisher) findViewById(R.id.<font color='blue'>yourSecondLayoutID</font>);
+
    <br><font color='#676A6C'>widget2</font>.loadZoneId("<font color='blue'>ZoneID</font>");
+
== <font color='#2D95DB'>Display Android Editorials</font> ==
+
To display Android Editorials inside your android application, you need to instantiate the A4GEditorial class to allow you to call the functions from the AndroidSDKPublisher.
+
<br>You need to use one of the three methods (you can use all of them) bellow:
+
<br>'''1­- showA4GEdito :''' If you want to display the editorials once the activity's started.
+
<br>'''2­- showA4GEditoWithStartTime :''' If you want to display the editorials after certain time.
+
<br>'''3­- showA4GEditoWithStartAndEndTime :''' If you want to display the editorials after certain time and close them automatically after certain time.   
+
<br>'''4­- showA4GEditoOnClick :''' If you want to display the editorials when the user click on a button.
+
          <dd><font color='red'>'''Note:'''</font> The three first methods mentioned above are valid only if your project target android '''3.0''' or above, '''showA4GEditoOnClick''' is <br>valid from android '''2.3''' or above.
+
<br>To use one of the three methods mentioned above, you need to define a View and assign it to the A4GEditorial object like shown bellow:
+
          <dd><font color='magenta'>'''protected void'''</font> onCreate(Bundle savedInstanceState) {
+
              <font color='magenta'>'''super'''</font>.onCreate(savedInstanceState);
+
              setContentView(<font color='blue'>R.layout.activity_main</font>);
+
              A4GEditorial <font color='blue'>a4gEdito</font> = <font color='magenta'>new</font> A4GEditorial(getApplicationContext());
+
              a4gEdito.setZoneid("<font color='blue'>zoneID</font>");
+
              View v = findViewById(R.id.<font color='blue'>yourView</font>); <font color='green'>// a textView or any composant that you use inside your activity</font>
+
              <font color='blue'>a4gEdito</font>.setVue(v);
+
              <font color='blue'>a4gEdito</font>.showA4GEdito(getApplicationContext());
+
              <font color='blue'>a4gEdito</font>.showA4GEditoWithStartTime(getApplicationContext(), <font color='blue'>5000</font>);
+
              <font color='blue'>a4gEdito</font>.showA4GEditoWithStartAndEndTime(getApplicationContext(), <font color='blue'>3000</font>, <font color='blue'>10000</font>);
+
        }
+
<br>To use '''showA4GEditoOnClick''' function, you need to define a button and assign it to the A4GEditorial object like shown below:
+
        <dd>Button <font color='blue'>myButton</font> = (Button)findViewById(<font color='blue'>R.id.yourButton</font>);
+
        <font color='blue'>a4gEdito</font>.setButton(<font color='blue'>myButton</font>);
+
        <font color='blue'>a4gEdito</font>.showA4GEditoOnClick(getApplicationContext());
+

Latest revision as of 11:46, 11 November 2013


Contents

[edit] Publishers

[edit] Download iOS SDK

Download the [iOS SDKv3.0 for publishers]. Decompress the zip file and extract the files to your development mac.
The Ad4game iOS SDK is provided as a single framework file (A4GPub.framework), making it easy to include in your iOS project.

[edit] Include the A4GPub.framework

To include the A4GPub.framework to your xcode project, you need to select your target project, and then go to Build Phases → Link Binary With Libraries,
then click on the + sign → Add Other, and select the A4GPub.framework saved on your mac as shown below:

[edit] Include the AdSupport.framework

You need to include the AdSupport.framework to your project target to enable the Advertiser Identifier functionality.
Go to Build Phases → Link Binary With Libraries, then click on the + sign to add the AdSupport.framework as shown below:

Then, change the value of AdSupport.framework from Required to Optional.

[edit] Include the SystemConfiguration.framework

You need to include the SystemConfiguration.framework to your project target to enable detection of the connection type. Go to Build Phases → Link Binary With Libraries, then click on the + sign to add the SystemConfiguration.framework.

[edit] Include the QuartzCore.framework

You need to include the QuartzCore.framework to your project target to customize the interface.
Go to Build Phases → Link Binary With Libraries, then click on the + sign to add the QuartzCore.framework.

[edit] Display Mobile Ads

To display ads on your iOS project, you need to follow the steps bellow:
In your ViewController.xib
– You need to add an UIImageView with the size of the ad.
– You need to add an UIButton above the UIImageView with the same size of the ad.
Connect the UIImageView and the UIButton to your ViewController.h file.

In your ViewController.h file
– You need to import the A4GPub.framework.
– Declare an Object of A4GPubViewController.
Your code need to be similar to this:

    
#import <A4GPub/A4GPubViewController.h> @interface TestViewController : UIViewController { IBOutlet UIImageView *image; A4GPubViewController *a4g; } - (IBAction)button : (id)sender; @end

In your ViewController.m file
– You need to import the A4GPub.framework.
– In your viewDidLoad method, you need to instantiate the object created on viewController.h file and call the different method to display ads.
The methods are:
* setZoneID method allows you to set the zoneID.
* setImageView method allows you to set your UIImageView.
* getRefresh method to refresh the display of banners.
* loadAds method to get banners from ad4game servers.

Your code need to be similar to this:

    
#import <A4GPub/A4GPubViewController.h> @implementation TestViewController – (void)viewDidLoad { [super viewDidLoad]; a4g = [[A4GPubViewController alloc] init]; [a4g setZoneID : @"yourZoneID"]; [a4g setImageView : yourUIImageView]; //in this example, its name is image [a4g getRefresh]; [a4g loadAds]; }

– In your ­ (IBAction)button : (id)sender method, you need to call the loadClick method allowing you to get the click associate to the ad displayed.

   
– (IBAction)button : (id)sender { [a4g loadClick]; }
  
Note: You can add many zones as you want, just instantiate the A4GPubViewController object as follow :

In your ViewController.h :

  
#import <A4GPub/A4GPubViewController.h> @interface TestViewController : UIViewController { IBOutlet UIImageView *imageOne; IBOutlet UIImageView *imagetwo; A4GPubViewController *a4gObject; A4GPubViewController *secondObject; } – (IBAction)buttonOne : (id)sender; – (IBAction)buttonTwo : (id)sender; @end

In your ViewController.m :

   
#import <A4GPub/A4GPubViewController.h> @implementation TestViewController -(void)viewDidLoad { [super viewDidLoad]; a4gObject = [[A4GPubViewController alloc] init]; secondObject = [[A4GPubViewController alloc] init]; [a4gObject setZoneID : @"FirstZoneID"]; [a4gObject setImageView : yourUIImageView]; [a4gObject getRefresh]; [a4gObject loadAds]; [secondObject setZoneID : @"SecondZoneID"]; [secondObject setImageView : yourUIImageView]; [secondObject getRefresh]; [secondObject loadAds]; } – (IBAction)buttonOne : (id)sender { [a4gObject loadClick]; } – (IBAction)buttonTwo : (id)sender { [secondObject loadClick]; }

[edit] Display iOS Editorials

To display iOS Editorials on your iOS project, you need to follow the steps bellow:

In your ViewController.xib
You need to add a UIButton if you want to launch the editorials when the user clicks on that button.
Connect the UIButton to your ViewController.h file.

In your ViewController.h file
– You need to import the A4GEdito.h header file.
– Declare an Object of A4GEdito.
Your code need to be similar to this:

  
#import <A4GPub/A4GEdito.h> @interface TestViewController : UIViewController { IBOutlet UIButton *editoButton; A4GEdito *a4gEdito; } @end

In your ViewController.m file
– In your viewDidLoad method, you need to instantiate the object created on your ViewController.h file and call the different method to display Editorials.
The methods are:
* setZoneID method, allows you to set the zoneID.
* setButton method, allows you to set your UIButton.
* showA4GEditos method, to display directly the Editorials when the app started.
* showA4GEditosWithStartTime method, to display the Editorials after a certain time.
* showA4GEditosWithStartAndEndTime method, to display the Editorials after a certain time, and close them automatically after a certain time.

Your code need to be similar to this:

   
@implementation TestViewController –(void)viewDidLoad { [super viewDidLoad]; a4gEdito = [[A4GEdito alloc] init]; [a4gEdito setZoneID : @"yourZoneID"]; [a4gEdito setButton : yourUIButton]; //in this example, its name is editoButton. [[a4gEdito getButton] addTarget : a4gEdito action : @selector(showA4GEditos) forControlEvents:UIControlEventTouchUpInside]; //this line add “showA4GEditos” action to your UIButton. [a4gEdito showA4GEditos]; //Display Editorials directly when the app started. [a4gEdito showA4GEditosWithStartTime:15]; //Display Editorials after 15 seconds. [a4gEdito showA4GEditosWithStartAndEndTime : 10 withArg2 : 30]; //Display Editorials after 10 seconds and close it automatically after 30 seconds. }

[edit] Display iOS Interstitials

To display iOS Interstitials on your iOS project, you need to follow the steps bellow:
In your ViewController.h file
- You need to import the A4GInterstitials.h header file.
- Declare an Object of A4GInterstitials.
Your code need to be similar to this:

  
#import <A4GPub/A4GInterstitials.h> @interface TestViewController : UIViewController { A4GInterstitials *a4gInter; } @end

In your ViewController.m file

- In your viewDidLoad method, you need to instantiate the object created on your ViewController.h file and call the differents method to display Interstitials.
The methods are:


* setZoneID method, allows you to set the zoneID.
* showA4GInterstitials method, to display directly the Interstitials when the app started.
* showA4GInterstitialsWithStartTime method, to display the interstitials after a certain time.
* showA4GInterstitialsWithStartAndEndTime method, to display the interstitials after a certain time, and close them automatically after a certain time.
Your code need to be similar to this:

  
@implementation TestViewController –(void)viewDidLoad { [super viewDidLoad]; a4gInter = [[A4GInterstitials alloc] init]; [a4gInter setZoneID : @"yourZoneID"]; [a4gInter showA4GInterstitials]; //Display Interstitials directly when the app started. [a4gInter showA4GInterstitialsWithStartTime:15]; //Display Interstitials after 15 seconds. [a4gInter showA4GInterstitialsWithStartAndEndTime : 10 withArg2 : 30]; //Display Interstitials after 10 seconds and close them automatically after 30 seconds. }

[edit] Advertisers

[edit] Download iOS SDK

Download the [iOS SDKv1.0 for advertisers]. Decompress the zip file and extract the files to your development mac.
The Ad4game iOS SDK is provided as a single framework file (A4GTrack.framework), making it easy to include in your iOS project.

[edit] Include the A4GTrack.framework

To include the A4GTrack.framework to your xcode project, you need to select your target project, and then go to Build Phases → Link Binary With Libraries, then click on the + sign → Add Other, and select the A4GTrack.framework saved on your mac as shown below:

[edit] Include the AdSupport.framework

You need to include the AdSupport.framework to your project target to enable the Advertiser Identifier functionality.
Go to Build Phases → Link Binary With Libraries, then click on the + sign to add the AdSupport.framework as shown below:

Then, change the value of AdSupport.framework from Required to Optional.

[edit] Include the SystemConfiguration.framework

You need to include the SystemConfiguration.framework to your project target to enable detection of the internet availability.
Go to Build Phases → Link Binary With Libraries, then click on the + sign to add the SystemConfiguration.framework.

[edit] Tracking installations

In your appDelegate.m, you need to import the A4GTrack.framework
#import <A4GTrack/A4GTrackViewController.h>
In your didFinishLaunchingWithOptions method, you need to call the trackInstall method thatallow you tracking installations once per user.
[ A4GTrackViewController trackInstall:@"yourTrackerID"].

[edit] Contact

If you've got questions, we've got answers! Please Contact Us at tech@ad4game.com with any technical queries.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox