Difference between revisions of "IOS"

From Ad4Game Developers
Jump to: navigation, search
(Include the AdSupport.framework)
(Install the Android SDK)
Line 14: Line 14:
 
<br>Then, change the value of AdSupport.framework from Required to '''Optional'''.
 
<br>Then, change the value of AdSupport.framework from Required to '''Optional'''.
  
== <font color='#2D95DB'>Install the Android SDK</font> ==
+
== <font color='#2D95DB'>Include the SystemConfiguration.framework</font> ==
Add '''AndroidSDKPublisher.jar''' to your Android project's build path.  
+
You need to include the '''SystemConfiguration.framework''' to your project target to enable detection of the connection type.
<br>If you are using Eclipse, right click on your '''project folder ­> Properties ­> Java Build Path ­> Libraries ­> Add JARs'''.
+
Go to '''Build Phases → Link Binary With Libraries''', then click on the '''+''' sign to add the SystemConfiguration.framework.
<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 mobile ads inside your android application, you need to set the value of <font color='blue'>"refresh"</font> variable to refresh banners.

Revision as of 09:46, 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.

Display Mobile Ads

To display mobile ads inside your android application, you need to set the value of "refresh" variable to refresh banners.
You'll then need to instantiate the A4GPublisher class to allow you to call the functions from the AndroidSDKPublisher.
Generally, the code is placed inside your main activity’s onCreate(Bundle) method.
You will need to pass the layout ID to the findViewById method, and then call loadZoneId(“ZoneID”) method.

      

public class MyClass extends Activity {
public static int refresh = 30000; //30 seconds
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_a4g);
A4GPublisher widget = (A4GPublisher) findViewById(R.id.yourLayoutID);
widget.loadZoneId("ZoneID");
}
}


In your layout.xml file, you need to include the properties of the layout where you want to display the banners as follows


<com.a4gpublisher.A4GPublisher
android:id="@+id/yourLayoutID"
android:id="@+id/yourLayoutID"
android:layout_width="350dp"
android:layout_height="250dp"
...
/>

Note: You can add many zones as you want, just instantiate the A4GPublisher object to create many widgets.

Example:

   
A4GPublisher widget1 = (A4GPublisher) findViewById(R.id.yourFirstLayoutID);
widget1.loadZoneId("ZoneID");

A4GPublisher widget2 = (A4GPublisher) findViewById(R.id.yourSecondLayoutID);
widget2.loadZoneId("ZoneID");

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