Skip to content

Commit

Permalink
update v2.0.6
Browse files Browse the repository at this point in the history
update version 2.0.6
  • Loading branch information
baishixian committed Jan 16, 2017
1 parent 77c9e7f commit cb0ddac
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 77 deletions.
14 changes: 10 additions & 4 deletions Docs/Getting_Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,23 @@
**1.在7.0中下载安装apk文件共享必须使用FileProvider,所以需要在AndroidManifest.xml配置如下代码:**

<!-- 配置provider用于适配7.0, authorities的{{com.sunteng.sdk.video}}部分替换成当前应用包名,
authorities = "{{BuildConfig.APPLICATION_ID}}.download.STVideoSdk.fileProvider" ,
authorities = "{{BuildConfig.APPLICATION_ID}}.download.fileProvider" ,
provider_paths为创建在xml文件夹内的资源文件 -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities= "com.sunteng.sdk.video.download.STVideoSdk.fileProvider"
android:authorities= "com.sunteng.sdk.video.download.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>

> 注意:如果你的项目之前已经在AndroidManifest.xml配置过FileProvider,sdk也提供了在代码中统一配置FileProvider的接口设置authorities:
` public static void setFileProviderAuthorities(String authorities);`


**2.可以看到上面在AndroidManifest.xml的<meta-data中,定义了一个资源路径,第二步就是创建res/xml/provider_paths.xml文件:**
> **注意:只需把path中{{com.sunteng.sdk.video}}部分替换成你当前项目的包名,复制到文件中即可。**
Expand All @@ -55,9 +61,9 @@
- **调用全局初始化sdk:**

MobileAdSDK.initSDKWithPublishedID(String publisherId, String appId, int placementId, String appKey)
MobileAdSDK.initSDKWithPublishedID(String AdUnitId, String AppSecret)
> **注意:**
> 从Sunteng获取publisherID & appID & placementId & appKey
> 从Sunteng获取AdUnitId & AppSecret
- **开启debug模式**
> 用于测试阶段日志输出控制,设置logcat过滤器tag为“videoSdk”。
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

## Change Log

01/16/2016 - [v2.0.6](https://github.com/shunfei/STVideoSDK-Android/releases/tag/v2.0.6)

* Update API.

12/30/2016 - [v2.0.5](https://github.com/shunfei/STVideoSDK-Android/releases/tag/v2.0.5)

* New support autoRotate.
Expand Down
Binary file removed STVideoSDK/suntengvideo2.0.5.jar
Binary file not shown.
Binary file added STVideoSDK/suntengvideo2.0.6.jar
Binary file not shown.
Binary file modified STVideoSDKSample/STVideoSDK-sample.apk
Binary file not shown.
28 changes: 0 additions & 28 deletions STVideoSDKSample/VideoAdSample/.gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
# Created by .ignore support plugin (hsz.mobi)

### OSX template
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Android template
# Built application files
*.apk
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions STVideoSDKSample/VideoAdSample/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion STVideoSDKSample/VideoAdSample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ dependencies {
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile files('libs/suntengvideo2.0.5.jar')
compile files('libs/suntengvideo2.0.6.jar')
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<!-- 配置provider用于适配7.0, authorities的值固定, provider_paths为创建在xml文件夹内的资源文件 -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.sunteng.videoadsample.download.STVideoSdk.fileProvider"
android:authorities="com.sunteng.videoadsample.download.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
public static final int FULL_VIEWID = 109;

/**
* 从sunteng网站申请获取publisherId, appId, placementId, APP_KEY
* 从sunteng网站申请获取AdUnitID
*
*/
public static final String PUBLISHERID = "2";
public static final String APPID = "38";
public static final int PLACEMENTID = 42;
public static final String AdUnitID = "2-38-42";
public static final String APP_KEY = "8hME_QwQ2GkZT9.VDIwvwSY4*Skjg?Uf";


Expand All @@ -48,8 +46,8 @@ protected void onCreate(Bundle savedInstanceState) {
mContext = this;

// 初始化sdk,程序启动的时候调用
// 参数:从商务人员获取的publisherId, appId, placementId
MobileAdSDK.initSDKWithPublishedID(PUBLISHERID, APPID, PLACEMENTID, APP_KEY);
// 参数:从商务人员获取的AdUnitID
MobileAdSDK.initSDKWithPublishedID(AdUnitID, APP_KEY);

//若是在测试时使用,需开启debug模式,可查看日志输出
//参数: isDebug 传入true开启
Expand All @@ -59,14 +57,17 @@ protected void onCreate(Bundle savedInstanceState) {
//参数: isLocationEnable 传入true开启
MobileAdSDK.setLocationEnable(true);

// 调用该方法可以设置FileProvider,需同manifest一起更改
// MobileAdSDK.setFileProviderAuthorities("com.videoAd.sample");


//创建一个全屏模式视频广告组件
//参数:视频广告的视图id viewid
fullModelVideoAd = MobileAdSDK.createFullModelVideoAd(FULL_VIEWID);

//预加载视频广告
/* //预加载视频广告
//参数:播放页面的Activity 成功播放广告视频或发生错误均会回调的广告监听器VideoAdRequestListener 强制预加载为true
fullModelVideoAd.preDownloadResource(this, videoAdRequestListener, true);
fullModelVideoAd.preDownloadResource(this, videoAdRequestListener, true);*/

//初始化View
initView();
Expand All @@ -77,6 +78,7 @@ protected void onCreate(Bundle savedInstanceState) {
* view组件初始化
*/
private void initView() {
findViewById(R.id.bt_load_video).setOnClickListener(this);
findViewById(R.id.bt_fullVideo).setOnClickListener(this);
findViewById(R.id.bt_Video).setOnClickListener(this);
}
Expand All @@ -85,16 +87,18 @@ private void initView() {
@Override
public void onRequestSucceed(int viewId) {
Log.i("VideoSdkSample","viewId onRequestSucceed");
Toast.makeText(MainActivity.this,"视频广告请求成功",Toast.LENGTH_SHORT).show();
}

@Override
public void onRequestFail(int viewId, int code) {
Tool.showToast(mContext, viewId, code);
Toast.makeText(MainActivity.this,"视频广告请求失败",Toast.LENGTH_SHORT).show();
}

@Override
public void onAdResourceReady(int viewId) {
Log.i("VideoSdkSample","viewId onAdResourceReady");
Toast.makeText(MainActivity.this,"视频广告资源准备好",Toast.LENGTH_SHORT).show();
}
};

Expand All @@ -106,7 +110,10 @@ public void onClick(View v) {
//参数:当前activity的context 成功播放广告视频或发生错误均会回调的广告监听器VideoAdListener
fullModelVideoAd.showVideo(mContext, videoAdListener);
break;

case R.id.bt_load_video:
//请求视频广告
fullModelVideoAd.preDownloadResource(this, videoAdRequestListener, true);
break;
case R.id.bt_Video:
//打开播放窗口模式的视频广告
startActivity(new Intent(MainActivity.this, PlayActivity.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,28 @@


<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="vertical">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="vertical"
android:id="@+id/linearLayout">

<Button
android:text="请求加载视频广告"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/linearLayout"
android:layout_centerHorizontal="true"
android:padding="@dimen/button_dimen"
android:layout_marginTop="@dimen/button_dimen"
android:id="@+id/bt_load_video"/>

<Button
android:id="@+id/bt_fullVideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/button_dimen"
android:padding="@dimen/button_dimen"
android:text="@string/full_video"
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<resources>
<string name="app_name">VideoAdSample</string>
<string name="power_tag">Video</string>
<string name="full_video">全屏视频广告</string>
<string name="common_video">窗口视频广告</string>
<string name="full_video">展示全屏视频广告</string>
<string name="common_video">展示窗口视频广告</string>
<string name="small_window">小窗口视频广告</string>
<string name="large_window">大窗口视频广告</string>
</resources>

0 comments on commit cb0ddac

Please sign in to comment.