Difference between revisions of "Add sdk eclipse"
From AdLocus
(Created page with "== Eclipse 整合說明 == === 加入 AdLocus JAR 檔 === * 下載 JAR 檔 * 在專案底下建立 libs 資料夾 * 將 AdLocus_<version>.jar 複製到 libs 資料夾底下 *...") |
(→AndroidManifest.xml 中加入以下權限) |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 5: | Line 5: | ||
* 將 AdLocus_<version>.jar 複製到 libs 資料夾底下 | * 將 AdLocus_<version>.jar 複製到 libs 資料夾底下 | ||
* 若您是升級 SDK, 請刪除舊版的JAR檔. | * 若您是升級 SDK, 請刪除舊版的JAR檔. | ||
| + | * Target SDK 請選擇 23 | ||
=== 加入 AdLocus Library Project === | === 加入 AdLocus Library Project === | ||
| Line 19: | Line 20: | ||
== AndroidManifest.xml 中加入以下權限 == | == AndroidManifest.xml 中加入以下權限 == | ||
| − | < | + | * 將 <span style="color:#000000; background-color:#FFFF00">${applicationId}</span> 替換成 package name,以 package name 為 com.adlocus.example 的範例如下: |
| − | + | android:authorities="com.adlocus.example.ADLOCUS_CONTENT" | |
| − | + | ||
| − | < | + | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | <activity android:name="com.adlocus.AdActivity" | + | <uses-permission android:name="android.permission.INTERNET" /> |
| + | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
| + | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
| + | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
| + | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | ||
| + | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| + | |||
| + | // Promotion | ||
| + | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | ||
| + | <uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
| + | |||
| + | |||
| + | <provider | ||
| + | android:name="com.adlocus.util.MultiProcessPreferences" | ||
| + | android:authorities="<span style="color:#000000; background-color:#FFFF00">${applicationId}</span>.ADLOCUS_CONTENT" | ||
| + | android:exported="false" /> | ||
| + | <activity android:name="com.adlocus.AdActivity" | ||
android:theme="@style/AdLocusDialogTheme" | android:theme="@style/AdLocusDialogTheme" | ||
android:launchMode="singleTask" | android:launchMode="singleTask" | ||
android:excludeFromRecents="true" > | android:excludeFromRecents="true" > | ||
| − | </activity> | + | </activity> |
| − | <service android:name="com.adlocus.push.PushService" | + | <service android:name="com.adlocus.push.PushService" |
android:process=":adlocus"> | android:process=":adlocus"> | ||
| − | </service> | + | </service> |
| − | + | ||
| − | <receiver | + | <receiver |
| − | + | android:enabled="true" | |
| − | + | android:process=":adlocus" | |
| − | + | android:name="com.adlocus.push.PushReceive"> | |
| − | + | <intent-filter> | |
| − | + | <action android:name="android.intent.action.BOOT_COMPLETED" /> | |
| − | + | <category android:name="android.intent.category.DEFAULT" /> | |
| − | + | </intent-filter> | |
<intent-filter> | <intent-filter> | ||
<action android:name="com.adlocus.action.RECEIVE" /> | <action android:name="com.adlocus.action.RECEIVE" /> | ||
</intent-filter> | </intent-filter> | ||
| − | </receiver> | + | </receiver> |
| + | |||
| + | //Interstitial | ||
| + | <activity | ||
| + | android:name="com.adlocus.VideoAdActivity" | ||
| + | android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" | ||
| + | android:hardwareAccelerated="true" | ||
| + | > | ||
| + | </activity> | ||
| − | + | == Proguard == | |
| − | + | * 您的專案若有透過 Proguard 進行混淆,請加入下列設定檔維持相容性。 | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| + | <syntaxhighlight lang="java"> | ||
| + | -keepattributes InnerClasses | ||
| + | -keep class **.R | ||
| + | -keep class **.R$* { | ||
| + | <fields>; | ||
| + | } | ||
| + | -keep public class com.adlocus.** {*;} | ||
| + | -keep class com.adlocus.adapters.AdLocusAdapter$MyJavaScriptInterface{<methods>;} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | |||
就這麼簡單,您已完成SDK的前期作業。 | 就這麼簡單,您已完成SDK的前期作業。 | ||
Latest revision as of 16:19, 25 February 2016
Contents
Eclipse 整合說明
加入 AdLocus JAR 檔
- 下載 JAR 檔
- 在專案底下建立 libs 資料夾
- 將 AdLocus_<version>.jar 複製到 libs 資料夾底下
- 若您是升級 SDK, 請刪除舊版的JAR檔.
- Target SDK 請選擇 23
加入 AdLocus Library Project
- 下載 Library Project.
- 加入 AdLocus Library Project 到您的 Eclipse Workspace 中
- 在您的專案內啟用 AdLocus Library Project
AndroidManifest.xml 中加入以下權限
- 將 ${applicationId} 替換成 package name,以 package name 為 com.adlocus.example 的範例如下:
android:authorities="com.adlocus.example.ADLOCUS_CONTENT"
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
// Promotion
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<provider
android:name="com.adlocus.util.MultiProcessPreferences"
android:authorities="${applicationId}.ADLOCUS_CONTENT"
android:exported="false" />
<activity android:name="com.adlocus.AdActivity"
android:theme="@style/AdLocusDialogTheme"
android:launchMode="singleTask"
android:excludeFromRecents="true" >
</activity>
<service android:name="com.adlocus.push.PushService"
android:process=":adlocus">
</service>
<receiver
android:enabled="true"
android:process=":adlocus"
android:name="com.adlocus.push.PushReceive">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.adlocus.action.RECEIVE" />
</intent-filter>
</receiver>
//Interstitial
<activity
android:name="com.adlocus.VideoAdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:hardwareAccelerated="true"
>
</activity>
Proguard
- 您的專案若有透過 Proguard 進行混淆,請加入下列設定檔維持相容性。
-keepattributes InnerClasses -keep class **.R -keep class **.R$* { <fields>; } -keep public class com.adlocus.** {*;} -keep class com.adlocus.adapters.AdLocusAdapter$MyJavaScriptInterface{<methods>;}
就這麼簡單,您已完成SDK的前期作業。






