一、eclipse部分
1.在百度搜BDGameSDK_V3.2.0(20150615)_For_Android可以获取百度sdk的包,目录:
2.百度sdk使用eclipse写的,转入android studio有好多问题 就用eclipse开发
在eclipse中新建android aplication项目
3.导入01-SDK客户端开发包中有BDGameSDK_LibProject类库,
4.导入BDGameSDK V3.7.1(20160704) For Android\BDGameSDK V3.7.1(20160704) For Android\BDGameSDK V3.7.1(20160704) For Android\03-客户端接口说明及范例下的BDGameDemo做参考
5.UnityBDGSdk中引入BDGameSDK_LibProject
按理说这样就可以 但是导入之后变成叉号了 可能是UnityBDGSdk和BDGameSDK_LibProject在不同的目录
使用下面的方式导入 这样的方式导入可以
6. 添加unity的class文件 路径网上有 mono添加mono目录下的classes il2cpp添加il2目录下的class
7.代码部分
接口文档中说需要写一个Application 可以在BDGameSDKDemo中找到demo
package com.test.sdk.application;
import android.app.Application;
import android.util.Log;
public class UnityBdApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
com.baidu.gamesdk.BDGameSDK.initApplication(this);
Log.i("Unity", "UnityBdApplication");
}
}
需要在unity的AndroidManifest.xml中配置启动
8.其他代码
BaseActivity
package com.youxigu.df;
import com.baidu.gamesdk.ActivityAdPage;
import com.baidu.gamesdk.ActivityAdPage.Listener;
import com.baidu.gamesdk.ActivityAnalytics;
import com.baidu.gamesdk.BDGameSDK;
import com.unity3d.player.UnityPlayerActivity;
import android.os.Bundle;
import android.widget.Toast;
public class BaseActivity extends UnityPlayerActivity {
private ActivityAdPage mActivityAdPage;
private ActivityAnalytics mActivityAnalytics;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
init();
}
private void init(){
mActivityAnalytics = new ActivityAnalytics(this);
mActivityAdPage = new ActivityAdPage(this, new Listener(){
@Override
public void onClose() {
// TODO 关闭暂停页, CP可以让玩家继续游戏
Toast.makeText(getApplicationContext(), "关闭", Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void onResume() {
super.onResume();
mActivityAdPage.onResume();
mActivityAnalytics.onResume();
BDGameSDK.onResume(this);
}
@Override
protected void onStop() {
super.onStop();
mActivityAdPage.onStop();
}
@Override
protected void onPause() {
super.onPause();
mActivityAdPage.onPause();
mActivityAnalytics.onPause();
BDGameSDK.onPause(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
mActivityAdPage.onDestroy();
BDGameSDK.closeFloatView(this);//关闭悬浮窗
}
}
MainActivity 需要继承base设置百度sdk的生命周期 unity中使用这个activity作为主Activity
package com.test.sdk;
import android.os.Bundle;
public class MainActivity extends BaseActivity {
@Override
protected void onCreate(Bundle bundle)
{
super.onCreate(bundle);
BDSdkApi.getInstance().onInit(this);
}
public void initBDGameSDK()
{
BDSdkApi.getInstance().initBDGameSDK();
}
public void onLogin()
{
BDSdkApi.getInstance().onLogin();
}
/**
@SuppressWarnings("unused")
private void initBDGameSDK(){
BDGameSDKSetting mBDGameSDKSetting = new BDGameSDKSetting();
mBDGameSDKSetting.setAppID(3067515);
mBDGameSDKSetting.setAppKey("f3Os4GAOqxgm79GqbnkT9L8T");
mBDGameSDKSetting.setDomain(Domain.DEBUG);
mBDGameSDKSetting.setOrientation(Utils.getOrientation(this));
BDGameSDK.init(this, mBDGameSDKSetting, new IResponse<Void>(){
@Override
public void onResponse(int resultCode, String resultDesc,
Void extraData) {
Log.d("Unity", "BDGameSDK.init"+resultDesc);
switch(resultCode){
case ResultCode.INIT_SUCCESS:
Toast.makeText(MainActivity.this, "初始化成功", 3).show();
break;
case ResultCode.INIT_FAIL:
default:
Toast.makeText(MainActivity.this, "初始化失败", Toast.LENGTH_LONG).show();
finish();
}
}
});
}
**/
}
BDSdkApi 曝露给unity调用
package com.test.sdk;
import java.util.UUID;
import com.baidu.gamesdk.BDGameSDK;
import com.baidu.gamesdk.BDGameSDKSetting;
import com.baidu.gamesdk.BDGameSDKSetting.Domain;
import com.baidu.gamesdk.IResponse;
import com.baidu.gamesdk.ResultCode;
import com.baidu.platformsdk.PayOrderInfo;
import com.test.sdk.utils.Utils;
import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
public class BDSdkApi {
public interface LoginCallback
{
public void callback(int code);
}
public interface PayCallback
{
public void callback(int code);
}
private Activity mActivity;
private LoginCallback mLoginCallBack = null;
private PayCallback mPayCallBack = null;
public static BDSdkApi mInstance = null;
public static BDSdkApi getInstance()
{
if (mInstance == null)
{
mInstance = new BDSdkApi();
}
return mInstance;
}
private Context getApplicationContext()
{
return mActivity.getApplicationContext();
}
public void setLoginCallBack(LoginCallback callback)
{
mLoginCallBack = callback;
}
public void setPayCallBack(PayCallback callback)
{
mPayCallBack = callback;
}
public void onInit(Context context) {
mActivity = (Activity)context;
Log.d("Unity", "BDSdkApi初始化");
}
//初始化
public void initBDGameSDK(){
BDGameSDKSetting mBDGameSDKSetting = new BDGameSDKSetting();
mBDGameSDKSetting.setAppID(3067515);
mBDGameSDKSetting.setAppKey("f3Os4GAOqxgm79GqbnkT9L8T");
mBDGameSDKSetting.setDomain(Domain.DEBUG);
mBDGameSDKSetting.setOrientation(Utils.getOrientation(mActivity));
BDGameSDK.init(mActivity, mBDGameSDKSetting, new IResponse<Void>(){
@Override
public void onResponse(int resultCode, String resultDesc,
Void extraData) {
Log.d("Unity", "BDGameSDK.init"+resultDesc);
switch(resultCode){
case ResultCode.INIT_SUCCESS:
Toast.makeText(getApplicationContext(), "初始化成功", 3).show();
break;
case ResultCode.INIT_FAIL:
default:
Toast.makeText(getApplicationContext(), "初始化失败", Toast.LENGTH_LONG).show();
mActivity.finish();
}
}
});
}
private int loginCode = -1;
public void onLogin(){
boolean isLogin = BDGameSDK.isLogined();
if (isLogin == false)
{
BDGameSDK.login(new IResponse<Void>() {
@Override
public void onResponse(int resultCode, String resultDesc, Void extraData) {
Log.d("login", "this resultCode is " + resultCode);
String hint = "";
switch(resultCode){
case ResultCode.LOGIN_SUCCESS:
hint = "登录成功";
loginCode = 1;
setSuspendWindowChangeAccountListener();//设置切换账号事件监听(个人中心界面切换账号)
setSessionInvalidListener();//设置会话失效监听
BDGameSDK.showFloatView(mActivity);//显示悬浮窗
break;
case ResultCode.LOGIN_CANCEL:
hint = "取消登录";
loginCode = 2;
break;
case ResultCode.LOGIN_FAIL:
default:
hint = "登录失败";
loginCode = -1;
}
Toast.makeText(getApplicationContext(), hint, Toast.LENGTH_LONG).show();
}
});
}
else
{
loginCode = 1;
Toast.makeText(getApplicationContext(), "已经登录", Toast.LENGTH_LONG).show();
}
if (mLoginCallBack != null)
{
mLoginCallBack.callback(loginCode);
}
}
//登录用户UID
public String getLoginUid()
{
return BDGameSDK.getLoginUid();
}
//登录用户AccessToken
public String getLoginAccessToken()
{
return BDGameSDK.getLoginAccessToken();
}
//注销
public void logout()
{
BDGameSDK.logout();
}
//支付
/**
* 构建订单信息
*/
//支付总金额 (以分为单位)
public PayOrderInfo buildOrderInfo(String totalAmount){
String cpOrderId = UUID.randomUUID().toString();//CP订单号
String goodsName = "金币";
int ratio = 1;//该参数为非定额支付时生效 (支付金额为0时为非定额支付,具体参见使用手册)
String extInfo = "第X号服务器,Y游戏分区充值";//扩展字段,该信息在支付成功后原样返回给CP
if(TextUtils.isEmpty(totalAmount)){
totalAmount = "0";
}
PayOrderInfo payOrderInfo = new PayOrderInfo();
payOrderInfo.setCooperatorOrderSerial(cpOrderId);
payOrderInfo.setProductName(goodsName);
long p = Long.parseLong(totalAmount);
payOrderInfo.setTotalPriceCent(p);//以分为单位
payOrderInfo.setRatio(ratio);
payOrderInfo.setExtInfo(extInfo);//该字段将会在支付成功后原样返回给CP(不超过500个字符)
return payOrderInfo;
}
/**
* @Description: 充值/支付
*/
int payCode = 0;
PayOrderInfo payDataInfo;
public void pay(String totalAmount){
PayOrderInfo payOrderInfo = buildOrderInfo(totalAmount);
if(payOrderInfo == null){
return;
}
BDGameSDK.pay(payOrderInfo, null,
new IResponse<PayOrderInfo>(){
@Override
public void onResponse(int resultCode, String resultDesc,
PayOrderInfo extraData) {
payDataInfo = extraData;
String resultStr = "";
switch(resultCode){
case ResultCode.PAY_SUCCESS://支付成功
resultStr = "支付成功:" + resultDesc;
payCode = 1;
break;
case ResultCode.PAY_CANCEL://订单支付取消
resultStr = "取消支付";
payCode = 2;
break;
case ResultCode.PAY_FAIL://订单支付失败
resultStr = "支付失败:" + resultDesc;
payCode = 3;
break;
case ResultCode.PAY_SUBMIT_ORDER://订单已经提交,支付结果未知(比如:已经请求了,但是查询超时)
resultStr = "订单已经提交,支付结果未知";
payCode = 4;
break;
}
Toast.makeText(getApplicationContext(), resultStr, Toast.LENGTH_LONG).show();
}
});
if (mPayCallBack != null)
{
mPayCallBack.callback(payCode);
}
}
private void setSuspendWindowChangeAccountListener(){//设置切换账号事件监听(个人中心界面切换账号)
BDGameSDK.setSuspendWindowChangeAccountListener(new IResponse<Void>(){
@Override
public void onResponse(int resultCode, String resultDesc,
Void extraData) {
switch(resultCode){
case ResultCode.LOGIN_SUCCESS:
loginCode = 1;
//TODO 登录成功,不管之前是什么登录状态,游戏内部都要切换成新的用户
Toast.makeText(getApplicationContext(), "登录成功", Toast.LENGTH_LONG).show();
break;
case ResultCode.LOGIN_FAIL:
loginCode = 2;
//TODO 登录失败,游戏内部之前如果是已经登录的,要清楚自己记录的登录状态,设置成未登录。如果之前未登录,不用处理。
Toast.makeText(getApplicationContext(), "登录失败", Toast.LENGTH_LONG).show();
break;
case ResultCode.LOGIN_CANCEL:
loginCode = 3;
//TODO 取消,操作前后的登录状态没变化
break;
}
}
});
if (mLoginCallBack != null)
{
mLoginCallBack.callback(loginCode);
}
}
/**
* @Description: 监听session失效时重新登录
*/
private void setSessionInvalidListener(){
BDGameSDK.setSessionInvalidListener(new IResponse<Void>(){
@Override
public void onResponse(int resultCode, String resultDesc,
Void extraData) {
if(resultCode == ResultCode.SESSION_INVALID){
//会话失效,开发者需要重新登录或者重启游戏
onLogin();
}
}
});
}
}
9.导出jar 邮件项目 Export
纯接口只需要勾选src 导出
二. android studio部分 这个还有个网上找的讯飞的sdk,使用这个编写 部分逻辑写在这 纯baidusdk可以不用
1.jniLibs放的是讯飞语音的so类库
2.下面两步可以不是jar打包到aar中只在编译时使用
3.代码部分
SDKApi用来unity交互
package com.test.sdk;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import com.unity3d.player.UnityPlayer;
public class SDKApi {
private Activity mActivity = null;
private String mPlatform = "";
private static SDKApi mInstance = null;
public static SDKApi getInstance()
{
if (mInstance == null)
{
mInstance = new SDKApi();
}
return mInstance;
}
public void onCreate(Context context)
{
mActivity = (Activity)context;
BDSdkApi.getInstance().onInit(mActivity);
Log.d("Unity", "初始化api成功");
}
public Activity getActivity()
{
return mActivity;
}
public Context getApplicationContext()
{
return mActivity.getApplicationContext();
}
//讯飞语音实例
public XFApi getXFInstance()
{
return XFApi.getInstance();
}
//初始化sdk
public void onInitSDK(String platform)
{
mPlatform = platform;
switch (mPlatform)
{
case "baidu":
BDSdkApi.getInstance().initBDGameSDK();
break;
}
}
//登陆
public void onLogin()
{
Log.d("Unity", "登陆"+mPlatform);
switch (mPlatform)
{
case "baidu":
BDSdkApi.getInstance().logout();
BDSdkApi.getInstance().setLoginCallBack(new BDSdkApi.LoginCallback() {
@Override
public void callback(int code) {
UnityPlayer.UnitySendMessage("SDKManager", "OnLoginCallBack",String.valueOf(code));
}
});
BDSdkApi.getInstance().onLogin();
break;
}
}
//登录用户UID
public String getLoginUid()
{
Log.d("Unity", "登陆");
switch (mPlatform)
{
case "baidu":
return BDSdkApi.getInstance().getLoginUid();
}
return "";
}
//登录用户AccessToken
public String getLoginAccessToken()
{
Log.d("Unity", "登陆");
switch (mPlatform)
{
case "baidu":
return BDSdkApi.getInstance().getLoginAccessToken();
}
return "";
}
//注销
public void logout()
{
Log.d("Unity", "登陆");
switch (mPlatform)
{
case "baidu":
BDSdkApi.getInstance().logout();
}
}
//支付
public void pay(String money)
{
Log.d("Unity", "支付");
switch (mPlatform)
{
case "baidu":
BDSdkApi.getInstance().setPayCallBack(new BDSdkApi.PayCallback() {
@Override
public void callback(int code) {
UnityPlayer.UnitySendMessage("SDKManager", "OnPayCallBack",String.valueOf(code));
}
});
BDSdkApi.getInstance().pay(money);
}
}
}
XFApi讯飞语音的java
package com.test.sdk;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.iflytek.cloud.InitListener;
import com.iflytek.cloud.RecognizerListener;
import com.iflytek.cloud.RecognizerResult;
import com.iflytek.cloud.SpeechConstant;
import com.iflytek.cloud.SpeechError;
import com.iflytek.cloud.SpeechRecognizer;
import com.iflytek.cloud.SpeechSynthesizer;
import com.iflytek.cloud.SpeechUtility;
import com.iflytek.cloud.SynthesizerListener;
import com.unity3d.player.UnityPlayer;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
public class XFApi {
private SDKApi sdkApi = SDKApi.getInstance();
public SpeechRecognizer speechRecognizer;
public SpeechSynthesizer speechSynthesizer;
private String ttsSpeakerName = "yefang";
private String ttsSpeakerPitch = "50";
private static XFApi mInstance = null;
public static XFApi getInstance()
{
if (mInstance == null)
{
mInstance = new XFApi();
}
return mInstance;
}
private void onInit() {
//注意这里的appid为
SpeechUtility.createUtility(sdkApi.getApplicationContext(),"appid=58880d30");
initRecognizer();
}
//初始化
private void initRecognizer(){
speechRecognizer = SpeechRecognizer.createRecognizer(sdkApi.getApplicationContext(),mInitListener);
speechSynthesizer = SpeechSynthesizer.createSynthesizer(sdkApi.getApplicationContext(),mInitSpeaking);
}
public InitListener mInitListener = new InitListener() {
@Override
public void onInit(int i) {
UnityPlayer.UnitySendMessage("FlyTalk", "OnInit", "init Listener success!");
}
};
public InitListener mInitSpeaking = new InitListener() {
@Override
public void onInit(int i) {
UnityPlayer.UnitySendMessage("FlyTTS", "OnInit", "init Speaking success!");
}
};
//TTS是Text To Speech的缩写,即“从文本到语音”
public void setTTSSpeaker(String targetName) {
ttsSpeakerName = targetName;
}
public void setTTSPitch(String targetPitch) {
ttsSpeakerPitch = targetPitch;
}
public void doTTS(String ttsStr){
//设置发音人
speechSynthesizer.setParameter(SpeechConstant.VOICE_NAME,ttsSpeakerName);
//设置音调
speechSynthesizer.setParameter(SpeechConstant.PITCH,ttsSpeakerPitch);
//设置音量
speechSynthesizer.setParameter(SpeechConstant.VOLUME,"50");
int code = speechSynthesizer.startSpeaking(ttsStr, mTTSListener);
//UnityPlayer.UnitySendMessage("FlyTTS", "IsSpeaking", ttsStr+String.valueOf(code));
}
private SynthesizerListener mTTSListener = new SynthesizerListener() {
@Override
public void onSpeakBegin() {
UnityPlayer.UnitySendMessage("FlyTTS", "SpeakingBegin", "SpeakingStart");
}
@Override
public void onBufferProgress(int i, int i1, int i2, String s) {
}
@Override
public void onSpeakPaused() {
}
@Override
public void onSpeakResumed() {
}
@Override
public void onSpeakProgress(int i, int i1, int i2) {
}
@Override
public void onCompleted(SpeechError speechError) {
UnityPlayer.UnitySendMessage("FlyTTS", "SpeakingEnd", speechError.toString());
}
@Override
public void onEvent(int i, int i1, int i2, Bundle bundle) {
UnityPlayer.UnitySendMessage("FlyTTS", "SpeakingEnd", "");
}
};
//开始听写
public void startSpeechListener(){
UnityPlayer.UnitySendMessage("FlyTalk", "Result", "");
speechRecognizer.setParameter(SpeechConstant.DOMAIN, "iat");
speechRecognizer.setParameter(SpeechConstant.LANGUAGE, "zh_cn");
speechRecognizer.setParameter(SpeechConstant.ACCENT, "mandarin");
speechRecognizer.startListening(mRecognizerListener);
}
public RecognizerListener mRecognizerListener = new RecognizerListener(){
@Override
public void onBeginOfSpeech() {
// TODO Auto-generated method stub
UnityPlayer.UnitySendMessage("FlyTalk", "OnSpeechStart", "SpeechBegin");
Log.d("Unity", "onBeginOfSpeech");
}
@Override
public void onEndOfSpeech() {
// TODO Auto-generated method stub
//UnityPlayer.UnitySendMessage("FlyTalk", "OnSpeechEnd","SpeechEnd");
Log.d("Unity", "onEndOfSpeech");
}
@Override
public void onError(SpeechError arg0) {
// TODO Auto-generated method stub
UnityPlayer.UnitySendMessage("FlyTalk", "OnSpeechError", arg0.getErrorDescription());
}
@Override
public void onEvent(int arg0, int arg1, int arg2, Bundle arg3) {
// TODO Auto-generated method stub
//UnityPlayer.UnitySendMessage("FlyTalk", "Result", "onEvent");
}
@Override
public void onResult(RecognizerResult recognizerResult, boolean isLast) {
printResult(recognizerResult);
}
@Override
public void onVolumeChanged(int arg0, byte[] arg1) {
//UnityPlayer.UnitySendMessage("FlyTalk", "Result", "onVolumeChanged");
// TODO Auto-generated method stub
}
};
//解析
private void printResult(RecognizerResult results) {
boolean isEnd = false;
String json = results.getResultString();
Log.d("Unity", json);
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
isEnd = joResult.getBoolean("ls");
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
// 转写结果词,默认使用第一个结果
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
JSONObject obj = items.getJSONObject(0);
ret.append(obj.getString("w"));
}
} catch (Exception e) {
e.printStackTrace();
}
//将解析结果“"result:" + ret.toString()”发送至“Manager”这个GameObject,中的“Result”函数
//UnityPlayer.UnitySendMessage("FlyTalk", "Result", ret.toString());
UnityPlayer.UnitySendMessage("FlyTalk", "OnSpeechResult", ret.toString());
if (isEnd)
{
UnityPlayer.UnitySendMessage("FlyTalk", "OnSpeechEnd","SpeechEnd");
}
}
public void ShowToast(final String mStr2Show){
//UnityPlayer.UnitySendMessage("FlyTalk", "OnResult", "toast");
sdkApi.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(sdkApi.getApplicationContext(),mStr2Show,Toast.LENGTH_LONG).show();
}
});
}
}
4.xml 主要是讯飞的权限
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.sdk">
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">
</application>
<!--连接网络权限,用于执行云端语音能力 -->
<uses-permission android:name="android.permission.INTERNET"/>
<!--获取手机录音机使用权限,听写、识别、语义理解需要用到此权限 -->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<!--读取网络信息状态 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!--获取当前wifi状态 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!--允许程序改变网络连接状态 -->
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<!--读取手机信息权限 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!--读取联系人权限,上传联系人需要用到此权限 -->
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<!--外存储写权限,构建语法需要用到此权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!--外存储读权限,构建语法需要用到此权限 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!--摄相头权限,拍照需要用到 -->
<uses-permission android:name="android.permission.CAMERA" />
</manifest>
5.编译生成aar
三、unity部分
1.在UNITY中建立这样目录
2.将百度sdk BDGameSDK_LibProject中的这些目录考入Unity对应的Android下面
3.BDGameSDK_LibProject 下面的AndroidManifest.xml与Unity的AndroidMainfest融合
注意
application中的android:name
主Activity
android:name="com.test.sdk.MainActivity"
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
android.intent.action.MAIN和android.intent.category.LAUNCHER只能有一个 要不然安装APK会出现两个图标
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.sdk" xmlns:tools="http://schemas.android.com/tools" android:versionName="1.0" android:versionCode="1" android:installLocation="preferExternal">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:isGame="true" android:banner="@drawable/app_banner" android:name="com.test.sdk.application.UnityBdApplication">
<activity android:label="@string/app_name" android:name="com.test.sdk.MainActivity" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<!-- ↓↓↓ SDK ↓↓↓ -->
<!-- 0-百度 1-多酷 2-91 -->
<meta-data android:name="BDPlatformType" android:value="0" />
<meta-data android:name="BDGameVersion" android:value="3.7.1" />
<activity
android:name="com.baidu.platformsdk.LoginActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:excludeFromRecents="true"
android:theme="@style/bdp_dialog_style_fullscreen"/>
<activity
android:name="com.baidu.platformsdk.AssistActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:excludeFromRecents="true"
android:theme="@style/bdp_dialog_style_fullscreen"/>
<activity
android:name="com.baidu.platformsdk.BindPhoneActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:excludeFromRecents="true"
android:theme="@style/bdp_dialog_style_fullscreen"/>
<activity
android:name="com.baidu.platformsdk.CashierDeskActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:theme="@style/bdp_dialog_style_fullscreen"
android:windowSoftInputMode="adjustPan"/>
<activity
android:name="com.baidu.platformsdk.WebActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="adjustPan"/>
<activity
android:name="com.baidu.platformsdk.ModifyPasswordActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:excludeFromRecents="true"
android:theme="@style/bdp_dialog_style_fullscreen"/>
<activity
android:name="com.baidu.platformsdk.ThirdPartyLoginActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:exported="false"/>
<activity
android:name="com.baidu.platformsdk.VisitorBindActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:excludeFromRecents="true"
android:theme="@style/bdp_dialog_style_fullscreen"/>
<activity
android:name="com.baidu.platformsdk.BaiduBeanDetailActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:windowSoftInputMode="adjustPan"
android:theme="@style/bdp_dialog_style_fullscreen" />
<activity
android:name="com.baidu.platformsdk.OrderDetailActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:windowSoftInputMode="adjustPan"
android:theme="@style/bdp_dialog_style_fullscreen" />
<activity
android:name="com.baidu.platformsdk.SapiWebActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:windowSoftInputMode="adjustPan"
android:theme="@style/bdp_dialog_style_fullscreen" />
<activity
android:name="com.baidu.platformsdk.SapiLoginProxyActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:windowSoftInputMode="adjustPan"
android:theme="@style/bdp_dialog_style_fullscreen" />
<activity
android:name="com.baidu.platformsdk.wxpay.PayActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:windowSoftInputMode="adjustPan"
android:theme="@style/bdp_style_transparent" />
<activity
android:name="com.baidu.platformsdk.AuthenticateActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="false"
android:theme="@style/bdp_dialog_style_fullscreen"
android:windowSoftInputMode="adjustPan" />
<service
android:name="com.baidu.platformsdk.BDPlatformService"
android:exported="false" />
<!-- ↑↑↑ SDK ↑↑↑ -->
<!-- ↓↓↓ 百度钱包 ↓↓↓ -->
<activity
android:name="com.baidu.wallet.passport.PassLoginActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:exported="@bool/bd_wallet_switch_global_debug"
android:hardwareAccelerated="false"
android:theme="@style/EbpayThemeActivitTranslucent"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name="com.baidu.paysdk.ui.LightappBrowseActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.WelcomeActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivityWelcome"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.PayResultActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name="com.baidu.paysdk.ui.PwdCheckActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivit"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" >
</activity>
<activity
android:name="com.baidu.paysdk.ui.PwdSetAndConfirmActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateVisible" >
</activity>
<activity
android:name="com.baidu.paysdk.ui.PwdPayActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivitTranslucent"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" />
<activity
android:name="com.baidu.paysdk.ui.WebViewActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name="com.baidu.paysdk.ui.SelectBindCardActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.SecurityCenterActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="adjustUnspecified|stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.PrivacyProtectionActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="adjustUnspecified|stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.PassWordFreeActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivit"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustUnspecified|stateHidden" />
<activity
android:name="com.baidu.wallet.core.plugins.pluginproxy.WalletProxyActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivit"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
<activity
android:name="com.baidu.wallet.core.plugins.pluginproxy.WalletProxyActivity2"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivitTranslucent"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity
android:name="com.baidu.wallet.core.plugins.pluginmanager.WalletPluginActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivityWelcome"
android:windowSoftInputMode="stateHidden"/>
<activity
android:name="com.baidu.paysdk.ui.PassNormalizeActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivit"
android:hardwareAccelerated="false"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name="com.baidu.paysdk.ui.ConfirmPayOrderActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.DiscountListActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivit"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name="com.baidu.paysdk.ui.SelectPayWayActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivitTranslucent"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.H5PayWebViewActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name="com.baidu.paysdk.ui.BindCardImplActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivit"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.SignChannelListActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.WalletSmsActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.baidu.paysdk.ui.PwdManagerActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivit"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustUnspecified|stateHidden" />
<activity
android:name="com.baidu.home.HomeWebViewActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:screenOrientation="portrait"
android:theme="@style/EbpayThemeActivit"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.baidu.scancode.ui.ScanCodePwdPayActivity"
android:configChanges="keyboardHidden|navigation|orientation|screenSize"
android:excludeFromRecents="true"
android:exported="@bool/bd_wallet_switch_global_debug"
android:theme="@style/EbpayThemeActivitTranslucent"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible|adjustResize" />
<!-- ↑↑↑ 百度钱包 ↑↑↑ -->
<!-- ↓↓↓ passport ↓↓↓ -->
<activity
android:name="com.baidu.sapi2.utils.LoginProtectAcitivity"
android:screenOrientation="portrait"
android:theme="@style/bdp_SapiTheme"
android:windowSoftInputMode="adjustPan" />
<!-- ↑↑↑ passport ↑↑↑ -->
<!-- ↓↓↓ 银联SDK ↓↓↓ -->
<activity
android:name="com.unionpay.uppay.PayActivity"
android:configChanges="orientation|keyboardHidden"
android:excludeFromRecents="true"
android:screenOrientation="landscape"
android:windowSoftInputMode="adjustResize" />
<!-- ↑↑↑ 银联SDK ↑↑↑ -->
<!-- ↓↓↓ 支付宝插件 ↓↓↓ -->
<activity android:name="com.alipay.sdk.app.H5PayActivity"
android:configChanges="orientation|keyboardHidden|navigation"
android:exported="false"
android:screenOrientation="behind" />
<activity android:name="com.alipay.sdk.auth.AuthActivity"
android:configChanges="orientation|keyboardHidden|navigation"
android:exported="false"
android:screenOrientation="behind" />
<!-- 需修改<data android:scheme="bdpsdk+packagename" /> -->
<activity
android:name="com.baidu.platformsdk.pay.channel.ali.AliPayActivity"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:exported="true"
android:launchMode="singleTop"
android:screenOrientation="behind" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="alipay.app" android:pathPrefix="/result"
android:scheme="bdpsdk+packagename" />
</intent-filter>
</activity>
<!-- ↑↑↑ 支付宝插件 ↑↑↑ -->
<!-- ↓↓↓ QQ插件 需修改<data android:scheme="qwallet"+packagename />
替换packagename为应用包名, 如:<data android:scheme="qwalletcom.baidu.test"
否则将无法收到支付结果通知!! />↓↓↓ -->
<activity
android:name="com.baidu.platformsdk.pay.channel.qqwallet.QQPayActivity"
android:launchMode="singleTop"
android:exported="true"
android:configChanges="orientation|navigation|screenSize|keyboard|keyboardHidden"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="qwallet+packagename" />
</intent-filter>
</activity>
<!-- ↑↑↑ QQ插件 ↑↑↑ -->
<!-- ↓↓↓ 多酷SDK ↓↓↓ -->
<!-- ↓↓↓ 多酷SDK ↓↓↓ -->
<activity
android:name="com.duoku.platform.ui.DKContainerActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:launchMode="singleTop"
android:theme="@style/dk_styledindicators" >
</activity>
<service android:name="com.duoku.platform.service.DKSuspensionService" />
<!-- push service client -->
<receiver android:name="com.duoku.platform.push.MyPushMessageReceiver" >
<intent-filter>
<!-- 接收push消息 -->
<action android:name="com.baidu.android.pushservice.action.MESSAGE" />
<!-- 接收bind,unbind,fetch,delete等反馈消息 -->
<action android:name="com.baidu.android.pushservice.action.RECEIVE" />
<action android:name="com.baidu.android.pushservice.action.notification.CLICK" />
</intent-filter>
</receiver>
<receiver
android:name="com.baidu.android.pushservice.PushServiceReceiver"
android:process=":bdservice_v1" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="com.baidu.android.pushservice.action.notification.SHOW" />
<action android:name="com.baidu.android.pushservice.action.media.CLICK" />
<!-- 以下四项为可选的action声明,可大大提高service存活率和消息到达速度 -->
<action android:name="android.intent.action.MEDIA_MOUNTED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>
<receiver
android:name="com.baidu.android.pushservice.RegistrationReceiver"
android:process=":bdservice_v1" >
<intent-filter>
<action android:name="com.baidu.android.pushservice.action.METHOD" />
<action android:name="com.baidu.android.pushservice.action.BIND_SYNC" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<service
android:name="com.baidu.android.pushservice.PushService"
android:exported="true"
android:process=":bdservice_v1" >
<intent-filter>
<action android:name="com.baidu.android.pushservice.action.PUSH_SERVICE" />
</intent-filter>
</service>
<!-- 4.4版本新增的CommandService声明,提升小米和魅族手机上的实际推送到达率 -->
<service
android:name="com.baidu.android.pushservice.CommandService"
android:exported="true" />
<activity
android:name="com.baidu.android.pushservice.PushKeepAlive"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- push结束 -->
<!-- 下载管理 -->
<activity
android:name="com.duoku.platform.ui.DKDownloadManagerActivity"
android:exported="false"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/dk_styledindicators" >
</activity>
<service android:name="com.duoku.platform.download.DownloadService" />
<receiver
android:name="com.duoku.platform.download.DownloadReceiver"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MEDIA_MOUNTED" />
<data android:scheme="file" />
</intent-filter>
</receiver>
<receiver android:name="com.duoku.platform.download.broadcast.AppMonitorReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<data android:scheme="package" />
</intent-filter>
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MEDIA_MOUNTED" />
<action android:name="android.intent.action.MEDIA_UNMOUNTED" />
<data android:scheme="file" />
</intent-filter>
</receiver>
<!-- 需修改android:authorities="packagename"替换packagename为应用包名, 如:android:authorities="com.baidu.test" -->
<provider
android:name="com.duoku.platform.download.DownloadProvider"
android:authorities="packagename"
android:exported="false" />
<!-- ↑↑↑ 多酷SDK ↑↑↑ -->
<!-- ↓↓↓ 录屏 ↓↓↓ -->
<activity
android:name="mobisocial.omlet.overlaybar.ui.activity.SigninActivity"
android:hardwareAccelerated="true"
android:screenOrientation="sensorLandscape"
android:theme="@style/Omp.Theme.Transparent" >
</activity>
<activity
android:name="mobisocial.omlet.overlaybar.ui.activity.UploadCompleteActivity"
android:hardwareAccelerated="true"
android:screenOrientation="sensorLandscape"
android:theme="@style/Omp.Theme.Dialog" >
</activity>
<activity
android:name="mobisocial.omlet.overlaybar.ui.activity.VideoEditorActivity"
android:configChanges="orientation|screenSize"
android:hardwareAccelerated="true"
android:screenOrientation="sensorLandscape"
android:theme="@style/Omp.Theme.Transparent" >
</activity>
<activity
android:name="mobisocial.omlet.overlaybar.ui.activity.ScreenshotEditActivity"
android:hardwareAccelerated="true"
android:screenOrientation="sensorLandscape"
android:theme="@style/Omp.Theme.Transparent" >
</activity>
<activity
android:name="mobisocial.omlet.overlaybar.ui.activity.MediaUploadActivity"
android:configChanges="orientation|screenSize"
android:exported="false"
android:hardwareAccelerated="true"
android:screenOrientation="sensorLandscape"
android:theme="@style/Omp.Theme.Transparent" >
</activity>
<service
android:name="mobisocial.omlet.overlaybar.util.FileUploadIntentService"
android:exported="false" >
</service>
<service
android:name="mobisocial.omlib.service.OmlibService"
android:exported="false"
android:label="Omlet Network Service" />
<!--需修改android:authorities="packagename.provider
替换packagename为应用包名, 如:android:authorities="com.baidu.test.provider" -->
<provider
android:name="mobisocial.omlib.service.OmlibContentProvider"
android:authorities="packagename.provider" />
<!--需修改android:authorities="packagename.initializer"
替换packagename为应用包名, 如:android:authorities="com.baidu.test.initializer" -->
<provider
android:name="glrecorder.Initializer"
android:authorities="packagename.initializer"
android:exported="false"
android:initOrder="2147483647" />
<!-- ↑↑↑ 录屏 ↑↑↑ -->
</application>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="26" />
<uses-feature android:glEsVersion="0x00020000" />
<supports-gl-texture android:name="GL_OES_compressed_ETC1_RGB8_texture" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>
4.android studio导出的arr放到Android目录下面 合成的Mainfest也放在这
5.bin目录放eclipse导出的jar包
6.unity代码调用部分
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class SDKManager : MonoBehaviour
{
string sdkPlatform = "baidu";
//sdk
public AndroidJavaObject sdkApi = null;
public void Awake()
{
mSdkManager = this;
Init();
}
public void Init()
{
#if UNITY_ANDROID && !UNITY_EDITOR
Debug.Log("sdkApi init");
AndroidJavaClass ajc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
if (ajc != null)
{
AndroidJavaObject jo = ajc.GetStatic<AndroidJavaObject>("currentActivity");
ajc = new AndroidJavaClass("com.test.sdk.SDKApi");
sdkApi = ajc.CallStatic<AndroidJavaObject>("getInstance");
sdkApi.Call("onCreate", jo);
if (sdkPlatform == "baidu")
{
sdkApi.Call("onInitSDK", "baidu");
}
Debug.Log("sdkApi init end");
}
#endif
}
//登陆
public void OnLogin()
{
#if UNITY_ANDROID
sdkApi.Call("onLogin");
#endif
}
public void OnLoginCallBack(int code)
{
#if UNITY_ANDROID
if (sdkPlatform == "baidu")
{
if (code == 1)
{
//登陆成功 执行登陆逻辑
}
}
#endif
}
//登录用户UID
public string GetLoginUid()
{
#if UNITY_ANDROID
return sdkApi.Call<string>("getLoginUid");
#endif
}
//登录用户AccessToken
public string GetLoginAccessToken()
{
#if UNITY_ANDROID
return sdkApi.Call<string>("getLoginAccessToken");
#endif
}
//注销
public void Logout()
{
#if UNITY_ANDROID
sdkApi.Call("logout");
#endif
}
public void Pay(string money)
{
#if UNITY_ANDROID
sdkApi.Call("pay", money);
#endif
}
public void OnPayCallBack(int code)
{
#if UNITY_ANDROID
if (sdkPlatform == "baidu")
{
if (code == 1)
{
Debug.Log("OnPayCallBack");
}
}
#endif
}
//讯飞语音
public AndroidJavaObject GetXFInstance()
{
#if UNITY_ANDROID && !UNITY_EDITOR
if (sdkApi != null)
{
return sdkApi.Call<AndroidJavaObject>("getXFInstance");
}
#endif
return null;
}
static private SDKManager mSdkManager = null;
static public SDKManager GetInstance()
{
return mSdkManager;
}
}
7.讯飞语音部分
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
public class FlyTTS : MonoBehaviour {
private AndroidJavaObject ajo;
public Button StartButton;
public InputField ResultText;
public StringBuilder message;
// Use this for initialization
void Start () {
if (StartButton)
{
StartButton.onClick.AddListener(() => { StartListening(); });
}
//sdk api
if (SDKManager.GetInstance().sdkApi != null)
{
ajo = SDKManager.GetInstance().GetXFInstance();
}
}
public void StartListening()
{
Debug.logger.logEnabled = true;
ajo.Call("doTTS", ResultText.text);
Debug.logger.LogError("Unity", "******************************");
Debug.logger.LogError("Unity", "FlyTTS StartListening" + ResultText.text);
}
public void SpeakingEnd(string err)
{
ajo.Call("ShowToast", "聆听结束" + err);
StartButton.interactable = true;
}
public void SpeakingBegin()
{
ajo.Call("ShowToast", "聆听开始");
StartButton.interactable = false;
}
}
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
public class FlyTalk : MonoBehaviour {
private AndroidJavaObject ajo;
public Button StartButton;
public Text ResultText;
public StringBuilder message = new StringBuilder();
void Awake()
{
if (SDKManager.GetInstance().sdkApi != null)
{
ajo = SDKManager.GetInstance().GetXFInstance();
ajo.Call("onInit");
}
}
// Use this for initialization
void Start () {
if (StartButton)
{
StartButton.onClick.AddListener(() => { StartListening(); });
}
}
public void StartListening()
{
//ResultText.text = "StartListening start";
ajo.Call("startSpeechListener");
//ResultText.text = "StartListening end";
}
public void OnInit(string ret)
{
ResultText.text += ret;
}
public void OnSpeechStart()
{
StartButton.interactable = false;
ajo.Call("ShowToast", "开始说话");
}
public void OnSpeechEnd()
{
StartButton.interactable = true;
ajo.Call("ShowToast", "说话结束");
message.Append("\n");
}
public void OnSpeechError(string ret)
{
ResultText.text = ret;
StartButton.interactable = true;
}
public void OnSpeechResult(string recognizerResult)
{
message.Append(recognizerResult);
ResultText.text = message.ToString();
}
//public void Result(string recognizerResult)
//{
// message.AppendLine(recognizerResult);
// ResultText.text = message.ToString();
//}
}
完成