「Android SDK Developer Guide」修訂間的差異

出自TAMedia
跳至導覽 跳至搜尋
imported>Wikiuser
imported>Wikiuser
(取消由Wikiuser對話)所作出的修訂 1964)
 
(未顯示同一使用者於中間所作的 6 次修訂)
行 1: 行 1:
== Android SDK Developer Guide ==
[[媒體:TAMedia Android SDK.zip|Download]]
*SDK相容性
 
:目前SDK相容於下列Android系統版本
[[Android_Getting Started|Getting Started]]
:#Android 2.2
 
:#Android 2.3
[[Android_Banner Ads I|Banner Ads]]
:#Android 3.x
 
:#Android 4.x
[[Android_Interstitial Ads|Interstitial Ads]]
*整合至應用程式
 
:*將adpmobile-lib.jar加入Android Project中<br/>將adpmobile-lib.jar檔案加入至Android Application Project當中。<br/>對Project點選右鍵點選'''Properties -> 點選 Java Build Path -> 點選Add External JARs''' [[檔案:1.png]]
[[Android_Integeration with AdMob Mediation|Integration with AdMob Mediation]]
:*加入必要權限<br/>TWMAd服務需使用”存取網路狀態”、”讀取約略位置”、”網路”等權限,請在AndroidManifest.xml檔案當中進行下列權限的宣告。
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> &lt;!-- optional --&gt;
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> &lt;!-- optional --&gt;
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
:*加入必要Activity<br/>宣告TWMAdActivity。
<activity android:name="com.taiwanmobile.pt.adp.view.TWMAdActivity" />
<activity android:name="com.taiwanmobile.pt.adp.view.TWMAdViewActivity" />
:*宣告Banner廣告版位
::*透過layout.xml的方式進行宣告
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=<nowiki>"http://schemas.android.com/apk/res/android"</nowiki>
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <com.taiwanmobile.pt.adp.view.TWMAdView
        android:id="@+id/adview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
    </com.taiwanmobile.pt.adp.view.TWMAdView>
</LinearLayout>
::*透過程式進行宣告
public class MainActivity extends Activity {
private TWMAdView adView = null;
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        adView = new TWMAdView(this);
        LinearLayout root = (LinearLayout)findViewById(R.id.root);
        root.addView(adView);
    }
    @Override
    protected void onStart() {
        super.onStart();
        adView.activeAd("<Your Slot ID>","<Your name>","0",”640x100”);
    }
}
:*啟動Banner廣告服務
void com.taiwanmobile.pt.adp.view.TWMAdView.activeAd(String slotId, String vendorId, String testmark, String format)
Parameters:
slotId 廣告版位Id
vendorId 開發者Id
testmark 是否測試標籤 , 0:表正式服務,1:表進行測試中
format 版位大小, 可選640x100, 320x320, 300x250, 1024x90, 728x90, 468x60, 110x700, 640x640
::輸入相關參數啟動廣告服務
@Override
protected void onStart() {
    super.onStart();
    adView.activeAd("<Your Slot ID>","<Your name>","0",”640x100”);
}
:*宣告Interstitial廣告版位,<br/>請以下述方式進行Interstitial Ad版位的宣告<br/><b>注意:目前Interstitial廣告有相同版位ID在同一台裝置上,每天只會展示一次廣告的限制</b>
twmAdViewInterstitial = new TWMAdViewInterstitial(this);
twmAdViewInterstitial.setTWMAdViewListener(new TWMAdViewListener() {
  @Override
  public void onReceiveAd(View view) { //call twmAdViewInterstitial show
  twmAdViewInterstitial.show();
  }
  @Override
  public void onFailedToReceiveAd(View view) {  //onFailedToReceiveAd
  }
});
:*啟動Interstitial廣告服務
void com.taiwanmobile.pt.adp.view.TWMAdViewInterstitial.activeAd(String slotId, String vendorId, boolean testmark)
Parameters:
slotId 廣告版位Id
vendorId 開發者Id
testmark 是否測試標籤 , false:表正式服務,true:表進行測試中
::輸入相關參數啟動廣告服務
twmAdViewInterstitial.activeAd("<Your Slot ID>", "<Your name>", true);
*畫面展示
{| width="70%" border="1"
|-
| align="center" | 應用程式開啟
| align="center" | 點擊Banner後開啟網頁
| align="center" | 點擊Banner後撥打電話
|-
| align="center" | [[檔案:2.png]]
| align="center" | [[檔案:3.png]]
| align="center" | [[檔案:4.png]]
|}

於 2022年2月9日 (三) 09:00 的最新修訂