Difference between revisions of "IOS"

From Ad4Game Developers
Jump to: navigation, search
(Install the Android SDK)
(Display Mobile Ads)
Line 18: Line 18:
 
Go to '''Build Phases → Link Binary With Libraries''', then click on the '''+''' sign to add the SystemConfiguration.framework.
 
Go to '''Build Phases → Link Binary With Libraries''', then click on the '''+''' sign to add the SystemConfiguration.framework.
  
== <font color='#2D95DB'>Display Mobile Ads</font> ==
+
== <font color='#2D95DB'>Include the QuartzCore.framework</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.
+
You need to include the '''QuartzCore.framework''' to your project target to customize the interface.
<br>You'll then need to instantiate the A4GPublisher class to allow you to call the functions from the AndroidSDKPublisher.  
+
<br>Go to '''Build Phases → Link Binary With Libraries''', then click on the '''+''' sign to add the QuartzCore.framework.
<br>Generally, the code is placed inside your main activity’s onCreate(Bundle) method.
+
<br>You will need to pass the layout ID  to the '''findViewById''' method, and then call '''loadZoneId'''(“'''ZoneID'''”) method.
+
      <br><br><font color='magenta'>public class</font> MyClass <font color='magenta'>extends</font> Activity {
+
      <br><dd><font color='magenta'>public static int</font> <font color='blue'>refresh</font> = 30000; <font color='green'>//30 seconds</font>
+
      <br><font color='#676A6C'>@Override</font>
+
      <br><font color='magenta'>protected void</font> onCreate(Bundle savedInstanceState) {
+
      <br><dd><font color='magenta'>super</font>.onCreate(savedInstanceState);
+
      <br>setContentView(R.layout.<font color='blue'>activity_a4g</font>);
+
      <br>A4GPublisher widget = (A4GPublisher) findViewById(R.id.<font color='blue'>yourLayoutID</font>);
+
      <br>widget.loadZoneId("<font color='blue'>ZoneID</font>");
+
      <br>}
+
      <br>}
+
  
<br>In your '''layout.xml''' file, you need to include the properties of the layout where you want to display the banners as follows
 
 
<br><font color='green'><com.a4gpublisher.A4GPublisher</font>
 
<br><font color='magenta'>android:id</font>=<font color='blue'>"@+id/yourLayoutID"</font>
 
<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> ==
 
== <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.
 
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.

Revision as of 09:50, 13 August 2013

Contents

Publishers

Download iOS SDK

Download the [iOS SDK 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.

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:

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.

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.

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.

Display Android Editorials

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.
You need to use one of the three methods (you can use all of them) bellow:
1­- showA4GEdito : If you want to display the editorials once the activity's started.
2­- showA4GEditoWithStartTime : If you want to display the editorials after certain time.
3­- showA4GEditoWithStartAndEndTime : If you want to display the editorials after certain time and close them automatically after certain time.
4­- showA4GEditoOnClick : If you want to display the editorials when the user click on a button.

         
Note: The three first methods mentioned above are valid only if your project target android 3.0 or above, showA4GEditoOnClick is
valid from android 2.3 or above.


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:

         
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); A4GEditorial a4gEdito = new A4GEditorial(getApplicationContext()); a4gEdito.setZoneid("zoneID"); View v = findViewById(R.id.yourView); // a textView or any composant that you use inside your activity a4gEdito.setVue(v); a4gEdito.showA4GEdito(getApplicationContext()); a4gEdito.showA4GEditoWithStartTime(getApplicationContext(), 5000); a4gEdito.showA4GEditoWithStartAndEndTime(getApplicationContext(), 3000, 10000); }


To use showA4GEditoOnClick function, you need to define a button and assign it to the A4GEditorial object like shown below:

       
Button myButton = (Button)findViewById(R.id.yourButton); a4gEdito.setButton(myButton); a4gEdito.showA4GEditoOnClick(getApplicationContext());
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox