54个文件已删除
4 文件已重命名
17个文件已修改
13个文件已添加
| | |
| | | <uses-permission android:name="android.permission.WRITE_APN_SETTINGS" /> |
| | | |
| | | |
| | | |
| | | <application |
| | | android:name="com.weikou.beibeivideo.BeibeiVideoApplication" |
| | | android:allowBackup="true" |
| | |
| | | </provider> |
| | | |
| | | |
| | | <!-- 极光推送 --> |
| | | <service |
| | | android:name=".service.JPushService" |
| | | android:enabled="true" |
| | | android:exported="false" |
| | | android:process=":pushcore"> |
| | | <intent-filter> |
| | | <action android:name="cn.jiguang.user.service.action" /> |
| | | </intent-filter> |
| | | </service> |
| | | |
| | | |
| | | <receiver |
| | | android:name=".receiver.MyJPushReceiver" |
| | | android:enabled="true" |
| | | android:exported="false"> |
| | | <intent-filter> |
| | | <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" /> |
| | | <category android:name="${applicationId}" /> |
| | | </intent-filter> |
| | | </receiver> |
| | | |
| | | |
| | | |
| | | <!-- 推送 --> |
| | | |
| | | <activity |
| | | android:name=".ui.push.OpenClickActivity" |
| | | android:name=".ui.push.PushOpenClickActivity" |
| | | android:exported="true"> |
| | | |
| | | |
| | | <intent-filter> |
| | | <action android:name="android.intent.action.VIEW" /> |
| | | |
| | | <category android:name="android.intent.category.DEFAULT" /> |
| | | <action android:name="com.weikou.beibeivideo.ui.push.OpenClickActivity" /> |
| | | <category android:name="android.intent.category.BROWSABLE" /> |
| | | <!-- 打开该activity的链接--> |
| | | <data |
| | | android:host="com.huawei.codelabpush" |
| | | android:path="/deeplink" |
| | | android:scheme="buwanpush" /> |
| | | |
| | | </intent-filter> |
| | | |
| | | </activity> |
| | | |
| | | |
| | | <!-- 华为推送自动初始化 --> |
| | | |
| | | <meta-data |
| | | android:name="push_kit_auto_init_enabled" |
| | | android:value="true" /> |
| | | <!-- 华为推送服务注册 --> |
| | | <service |
| | | android:name=".service.HWPushService" |
| | | android:exported="false"> |
| | | <intent-filter> |
| | | <action android:name="com.huawei.push.action.MESSAGING_EVENT" /> |
| | | </intent-filter> |
| | | </service> |
| | | <!--小米推送 --> |
| | | |
| | | <meta-data |
| | | android:name="XIAOMI_APPID" |
| | | android:value="${XIAOMI_APPID}"></meta-data> |
| | | <meta-data |
| | | android:name="XIAOMI_APPKEY" |
| | | android:value="${XIAOMI_APPKEY}"></meta-data> |
| | | |
| | | <receiver |
| | | android:name=".receiver.XMPushMessageReceiver" |
| | | android:exported="true"> |
| | | <intent-filter> |
| | | <action android:name="com.xiaomi.mipush.RECEIVE_MESSAGE" /> |
| | | </intent-filter> |
| | | <intent-filter> |
| | | <action android:name="com.xiaomi.mipush.MESSAGE_ARRIVED" /> |
| | | </intent-filter> |
| | | <intent-filter> |
| | | <action android:name="com.xiaomi.mipush.ERROR" /> |
| | | </intent-filter> |
| | | </receiver> |
| | | |
| | | <!--OPPO --> |
| | | <meta-data |
| | | android:name="OPPO_APPKEY" |
| | | android:value="${OPPO_APPKEY}" /> |
| | | <meta-data |
| | | android:name="OPPO_APPSECRET" |
| | | android:value="${OPPO_APPSECRET}" /> |
| | | |
| | | |
| | | <!-- VIVO推送 --> |
| | | <receiver |
| | | android:name=".receiver.VIVOPushMessageReceiver" |
| | | android:exported="false"> |
| | | <intent-filter> |
| | | <!--接收push消息--> |
| | | <action android:name="com.vivo.pushclient.action.RECEIVE" /> |
| | | </intent-filter> |
| | | </receiver> |
| | | |
| | | <!--Vivo Push开放平台中应用的appid 和api key--> |
| | | <meta-data |
| | | android:name="com.vivo.push.api_key" |
| | | android:value="${VIVO_APPKEY}" /> |
| | | |
| | | <meta-data |
| | | android:name="com.vivo.push.app_id" |
| | | android:value="${VIVO_APPID}" /> |
| | | |
| | | |
| | | <!--魅族推送 --> |
| | | |
| | | <meta-data |
| | | android:name="MEIZU_APPKEY" |
| | | android:value="${MEIZU_APPKEY}"></meta-data> |
| | | |
| | | <meta-data |
| | | android:name="MEIZU_APPID" |
| | | android:value="${MEIZU_APPID}"></meta-data> |
| | | |
| | | <receiver android:name=".receiver.MZPushMessageReceiver"> |
| | | <intent-filter> |
| | | <!-- 接收 push 消息 --> |
| | | <action android:name="com.meizu.flyme.push.intent.MESSAGE" /> |
| | | <!-- 接收 register 消息 --> |
| | | <action android:name="com.meizu.flyme.push.intent.REGISTER.FEEDBACK" /> |
| | | <!-- 接收 unregister 消息--> |
| | | <action android:name="com.meizu.flyme.push.intent.UNREGISTER.FEEDBACK" /> |
| | | <!-- 兼容低版本 Flyme3 推送服务配置 --> |
| | | <action android:name="com.meizu.c2dm.intent.REGISTRATION" /> |
| | | <action android:name="com.meizu.c2dm.intent.RECEIVE" /> |
| | | |
| | | <category android:name="${applicationId}" /> |
| | | </intent-filter> |
| | | </receiver> |
| | | |
| | | </application> |
| | | |
| | | </manifest> |
New file |
| | |
| | | { |
| | | "agcgw":{ |
| | | "backurl":"connect-drcn.dbankcloud.cn", |
| | | "url":"connect-drcn.hispace.hicloud.com", |
| | | "websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.cn", |
| | | "websocketurl":"connect-ws-drcn.hispace.dbankcloud.com" |
| | | }, |
| | | "agcgw_all":{ |
| | | "CN":"connect-drcn.hispace.hicloud.com", |
| | | "CN_back":"connect-drcn.dbankcloud.cn", |
| | | "DE":"connect-dre.hispace.hicloud.com", |
| | | "DE_back":"connect-dre.dbankcloud.cn", |
| | | "RU":"connect-drru.hispace.hicloud.com", |
| | | "RU_back":"connect-drru.dbankcloud.cn", |
| | | "SG":"connect-dra.hispace.hicloud.com", |
| | | "SG_back":"connect-dra.dbankcloud.cn" |
| | | }, |
| | | "client":{ |
| | | "cp_id":"890086000102013438", |
| | | "product_id":"9105163812218575689", |
| | | "client_id":"327170740694549568", |
| | | "client_secret":"1AD92B6573E4337C7522550024BBE61A188DFECD51352A8D0C17D1C7F0C6F6D0", |
| | | "project_id":"9105163812218575689", |
| | | "app_id":"10409568", |
| | | "api_key":"CV6k6L9rmDyEVcDB9HbgkLPCN106z8Wq37kQwo2hBHlt7txuD9uaIeEdAFNphEIY9k4XKA8x/nARKnJHMMvygkWVoJhN", |
| | | "package_name":"com.doudou.ysvideo" |
| | | }, |
| | | "service":{ |
| | | "analytics":{ |
| | | "collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn", |
| | | "resource_id":"p1", |
| | | "channel_id":"" |
| | | }, |
| | | "search":{ |
| | | "url":"https://search-drcn.cloud.huawei.com" |
| | | }, |
| | | "cloudstorage":{ |
| | | "storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn" |
| | | }, |
| | | "ml":{ |
| | | "mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn" |
| | | } |
| | | }, |
| | | "region":"CN", |
| | | "configuration_version":"2.0", |
| | | "appInfos":[ |
| | | { |
| | | "package_name":"com.doudou.ysvideo", |
| | | "app_id":"10409568" |
| | | } |
| | | ] |
| | | } |
| | |
| | | apply plugin: 'android' |
| | | apply plugin: 'com.huawei.agconnect' |
| | | dependencies { |
| | | implementation project(':library-ViewPagerIndicator') |
| | | implementation files('libs/SohuPlayerExtend_4.1.0_0_201606121225_open_release.jar') |
| | |
| | | implementation project(path: ':library-EventBus') |
| | | implementation project(path: ':library-VideoPlayer') |
| | | implementation project(path: ':library-common') |
| | | implementation project(path: ':library-jpush') |
| | | implementation project(path: ':library-push') |
| | | annotationProcessor 'com.github.jokermonn:permissions4m:2.1.2-processor' |
| | | //微信SDK |
| | | api 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+' |
| | | |
| | | //加载动画库 |
| | | implementation 'com.github.ybq:Android-SpinKit:1.4.0' |
| | | |
| | | //oppo_dependencies_start |
| | | // oppo 厂商 aar 需要单独引入 |
| | | implementation(name: 'com.heytap.msp-push-2.1.0', ext: 'aar') |
| | | |
| | | } |
| | | android { |
| | | signingConfigs { |
| | |
| | | } |
| | | |
| | | manifestPlaceholders = [ |
| | | JPUSH_PKGNAME: applicationId, |
| | | JPUSH_APPKEY : "c26d6c58b6aa5d0391248edf", //极光开发平台上注册的包名对应的appkey. |
| | | JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可. |
| | | //meizu_config_start |
| | | MEIZU_APPKEY : "MZ-dc40ea74e19948a683cb1876d5a8813e", |
| | | MEIZU_APPID : "MZ-139085", |
| | | MEIZU_APPKEY : "MEIZU-dc40ea74e19948a683cb1876d5a8813e", |
| | | MEIZU_APPID : "MEIZU-139085", |
| | | //meizu_config_end |
| | | //xiaomi_config_start |
| | | XIAOMI_APPID : "MI-2882303761517505364", |
| | | XIAOMI_APPKEY : "MI-5681750540364", |
| | | XIAOMI_APPID : "XIAOMI-2882303761517505364", |
| | | XIAOMI_APPKEY : "XIAOMI-5681750540364", |
| | | //xiaomi_config_end |
| | | //oppo_config_start |
| | | OPPO_APPKEY : "OP-9w8ke27Mlk8osgCoOkg4Ow8cg", |
| | | OPPO_APPID : "OP-3375605", |
| | | OPPO_APPSECRET: "OP-eAbC32A01d02E8073b7788F687769502", |
| | | OPPO_APPKEY : "OPPO-9w8ke27Mlk8osgCoOkg4Ow8cg", |
| | | OPPO_APPSECRET: "OPPO-eAbC32A01d02E8073b7788F687769502", |
| | | //oppo_config_end |
| | | //vivo_config_start |
| | | VIVO_APPKEY : "e9add1dfed7086061119d407857628ef", |
| | |
| | | android:layout_height="match_parent" |
| | | android:scaleType="centerCrop"></ImageView> |
| | | |
| | | |
| | | <ImageView |
| | | android:visibility="gone" |
| | | android:id="@+id/iv_vip" |
| | | android:layout_width="29.5dp" |
| | | android:layout_height="17.5dp" |
| | | android:layout_gravity="top|right" |
| | | android:src="@drawable/icon_video_vip" /> |
| | | |
| | | </FrameLayout> |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | |
| | | android:orientation="horizontal"> |
| | | |
| | | |
| | |
| | | android:layout_weight="120" |
| | | app:ratio="0.6667"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_movie_cover" |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_alignParentStart="true" |
| | | android:layout_alignParentLeft="true" |
| | | android:scaleType="centerCrop" /> |
| | | android:layout_height="match_parent"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_movie_cover" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_alignParentStart="true" |
| | | android:layout_alignParentLeft="true" |
| | | android:scaleType="centerCrop" /> |
| | | |
| | | <ImageView |
| | | android:id="@+id/iv_vip" |
| | | android:layout_width="29.5dp" |
| | | android:layout_height="17.5dp" |
| | | android:layout_gravity="top|right" |
| | | android:src="@drawable/icon_video_vip" |
| | | android:visibility="gone" /> |
| | | |
| | | </FrameLayout> |
| | | |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | |
| | |
| | | import com.loopj.android.http.RequestParams; |
| | | import com.loopj.android.http.ResponseHandlerInterface; |
| | | import com.loopj.android.http.SyncHttpClient; |
| | | import com.ut.device.UTDevice; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | |
| | | import org.json.JSONArray; |
| | | |
| | |
| | | params.put("Lat", lat); |
| | | params.put("Lng", lng); |
| | | params.put("Channel", channel); |
| | | try { |
| | | params.put("UtdId", UTDevice.getUtdid(context)); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (!StringUtils.isBlank(BeibeiVideoApplication.deviceNumber)) { |
| | | params.put("DeviceName", BeibeiVideoApplication.deviceName); |
| | | params.put("DeviceNumber", BeibeiVideoApplication.deviceNumber); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送绑定Token |
| | | * |
| | | * @param context |
| | | * @param type |
| | | * @param token |
| | | * @param handler |
| | | */ |
| | | public static void pushBindToken(Context context, String type, String token, |
| | | ResponseHandlerInterface handler, boolean async) { |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | if (loginUid != null) |
| | | |
| | | if (type != null) |
| | | params.put("type", type); |
| | | |
| | | if (token != null) |
| | | params.put("regId", token); |
| | | |
| | | String model = android.os.Build.MODEL; |
| | | if (model != null) |
| | | params.put("model", model); |
| | | |
| | | String version = android.os.Build.VERSION.RELEASE; |
| | | if (version != null) { |
| | | params.put("androidVersion", version); |
| | | } |
| | | |
| | | |
| | | commonPost(context, BASE_URL + "push/bindDeviceToken", params, null, handler, async, false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 上传PPTV播放记录 |
| | | * |
| | | * @param context |
| | | * @param cid |
| | | * @param vid |
| | | * @param handler |
| | | */ |
| | | public static void uploadPPTVPlayRecord(Context context, String cid, String vid, |
| | | ResponseHandlerInterface handler) { |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | String uid = UserUtil.getUid(context); |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | if (loginUid != null) |
| | | params.put("loginUid", loginUid); |
| | | if (uid != null) |
| | | params.put("Uid", uid); |
| | | params.put("Cid", cid); |
| | | params.put("Vid", vid); |
| | | commonPost(context, BASE_URL + "video/play/pptvPlay", params, handler); |
| | | } |
| | | |
| | | |
| | | public static LinkedHashMap<String, String> validateParams( |
| | | LinkedHashMap<String, String> params, Context context) { |
| | | params.put("System", "1"); |
| | |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | params.put("Version", version + ""); |
| | | params.put("Device", getDeviceId(context)); |
| | | try { |
| | | params.put("UtdId", UTDevice.getUtdid(context)); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | LinkedHashMap<String, String> map = validateParams(params, context); |
| | | FormBody.Builder builder = new FormBody.Builder(); |
| | | for (String key : map.keySet()) { |
| | |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | params.put("Version", version + ""); |
| | | params.put("Device", getDeviceId(context)); |
| | | try { |
| | | params.put("UtdId", UTDevice.getUtdid(context)); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | LinkedHashMap<String, String> map = validateParams(params, context); |
| | | RequestParams requestParams = new RequestParams(map); |
| | | if (BuildConfig.DEBUG) { |
| | |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.umeng.socialize.PlatformConfig; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.weikou.beibeivideo.ui.push.PushOpenClickActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.CrashHandler; |
| | | import com.weikou.beibeivideo.util.FunshionConstant; |
| | | import com.weikou.beibeivideo.util.ad.TTAdManagerHolder; |
| | | import com.weikou.beibeivideo.util.downutil.StringUtils; |
| | | import com.yeshi.push.PushUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import cn.jpush.android.api.JPushInterface; |
| | | |
| | | public class BeibeiVideoApplication extends Application { |
| | | |
| | |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | //极光推送 |
| | | JPushInterface.setDebugMode(true); |
| | | JPushInterface.init(this); |
| | | //推送 |
| | | PushUtil.inintPush(this, new PushUtil.ITokenListener() { |
| | | |
| | | @Override |
| | | public void onToken(String romType, String regId) { |
| | | BeibeiVideoAPI.pushBindToken(application, romType, regId, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | |
| | | } |
| | | },true); |
| | | } |
| | | }); |
| | | |
| | | Intent intent = new Intent(this, PushOpenClickActivity.class); |
| | | intent.putExtra("activity", "test"); |
| | | JSONObject params = new JSONObject(); |
| | | try { |
| | | params.put("id", "123123"); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | intent.putExtra("params", params.toString()); |
| | | String uriString = intent.toUri(Intent.URI_INTENT_SCHEME); |
| | | Log.i(TAG, uriString); |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.weikou.beibeivideo.receiver; |
| | | |
| | | import android.app.Activity; |
| | | import android.app.ActivityManager; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.util.Log; |
| | | |
| | | import com.meizu.cloud.pushsdk.MzPushMessageReceiver; |
| | | import com.meizu.cloud.pushsdk.PushManager; |
| | | import com.meizu.cloud.pushsdk.handler.MzPushMessage; |
| | | import com.meizu.cloud.pushsdk.platform.message.PushSwitchStatus; |
| | | import com.meizu.cloud.pushsdk.platform.message.RegisterStatus; |
| | | import com.meizu.cloud.pushsdk.platform.message.SubAliasStatus; |
| | | import com.meizu.cloud.pushsdk.platform.message.SubTagsStatus; |
| | | import com.meizu.cloud.pushsdk.platform.message.UnRegisterStatus; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | import com.weikou.beibeivideo.ui.SplashActivity; |
| | | import com.xiaomi.mipush.sdk.ErrorCode; |
| | | import com.xiaomi.mipush.sdk.MiPushClient; |
| | | import com.xiaomi.mipush.sdk.MiPushCommandMessage; |
| | | import com.xiaomi.mipush.sdk.MiPushMessage; |
| | | import com.xiaomi.mipush.sdk.PushMessageReceiver; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class MZPushMessageReceiver extends MzPushMessageReceiver { |
| | | private final String TAG=MZPushMessageReceiver.class.getSimpleName(); |
| | | /** |
| | | * 调用订阅方法后,会在此方法回调结果 |
| | | * 订阅方法:PushManager.register(context, appId, appKey) |
| | | * |
| | | * @param context |
| | | * @param registerStatus |
| | | */ |
| | | @Override |
| | | public void onRegisterStatus(Context context, RegisterStatus registerStatus) { |
| | | Log.i(TAG,"onRegisterStatus"); |
| | | String pushId = registerStatus.getPushId(); |
| | | BeibeiVideoAPI.pushBindToken(context, "mz", pushId, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | |
| | | } |
| | | },true); |
| | | } |
| | | |
| | | /** |
| | | * 调用取消订阅方法后,会在此方法回调结果 |
| | | * 取消订阅方法:PushManager.unRegister(context, appId, appKey) |
| | | * |
| | | * @param context |
| | | * @param unRegisterStatus |
| | | */ |
| | | @Override |
| | | public void onUnRegisterStatus(Context context, UnRegisterStatus unRegisterStatus) { |
| | | Log.i(TAG,"onUnRegisterStatus"); |
| | | } |
| | | |
| | | /** |
| | | * 调用开关转换或检查开关状态方法后,会在此方法回调开关状态 |
| | | * 通知栏开关转换方法:PushManager.switchPush(context, appId, appKey, pushId, pushType, switcher) |
| | | * 检查开关状态方法:PushManager.checkPush(context, appId, appKey, pushId) |
| | | * |
| | | * @param context |
| | | * @param pushSwitchStatus |
| | | */ |
| | | @Override |
| | | public void onPushStatus(Context context, PushSwitchStatus pushSwitchStatus) { |
| | | Log.i(TAG,"onPushStatus"); |
| | | } |
| | | |
| | | /** |
| | | * 调用标签订阅、取消标签订阅、取消所有标签订阅和获取标签列表方法后,会在此方法回调标签相关信息 |
| | | * 标签订阅方法:PushManager.subScribeTags(context, appId, appKey, pushId, tags) |
| | | * 取消标签订阅方法:PushManager.unSubScribeTags(context, appId, appKey, pushId,tags) |
| | | * 取消所有标签订阅方法:PushManager.unSubScribeAllTags(context, appId, appKey, pushId) |
| | | * 获取标签列表方法:PushManager.checkSubScribeTags(context, appId, appKey, pushId) |
| | | * |
| | | * @param context |
| | | * @param subTagsStatus |
| | | */ |
| | | @Override |
| | | public void onSubTagsStatus(Context context, SubTagsStatus subTagsStatus) { |
| | | Log.i(TAG,"onSubTagsStatus"); |
| | | } |
| | | |
| | | /** |
| | | * 调用别名订阅、取消别名订阅和获取别名方法后,会在此方法回调别名相关信息 |
| | | * 别名订阅方法:PushManager.subScribeAlias(context, appId, appKey, pushId, alias) |
| | | * 取消别名订阅方法:PushManager.unSubScribeAlias(context, appId, appKey, pushId, alias) |
| | | * 获取别名方法:PushManager.checkSubScribeAlias(context, appId, appKey, pushId) |
| | | * |
| | | * @param context |
| | | * @param subAliasStatus |
| | | */ |
| | | @Override |
| | | public void onSubAliasStatus(Context context, SubAliasStatus subAliasStatus) { |
| | | Log.i(TAG,"onSubAliasStatus"); |
| | | } |
| | | |
| | | /** |
| | | * 当用户点击通知栏消息后会在此方法回调 |
| | | * |
| | | * @param context |
| | | * @param mzPushMessage |
| | | */ |
| | | @Override |
| | | public void onNotificationClicked(Context context, MzPushMessage mzPushMessage) { |
| | | Log.i(TAG,"onNotificationClicked"); |
| | | |
| | | PushManager.getPushId(context); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 当推送的通知栏消息展示后且应用进程存在时会在此方法回调 |
| | | * |
| | | * @param context |
| | | * @param mzPushMessage |
| | | */ |
| | | @Override |
| | | public void onNotificationArrived(Context context, MzPushMessage mzPushMessage) { |
| | | Log.i(TAG,"onNotificationArrived"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.weikou.beibeivideo.receiver; |
| | | |
| | | import android.app.Activity; |
| | | import android.app.ActivityManager; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.util.Log; |
| | | |
| | | import com.vivo.push.model.UnvarnishedMessage; |
| | | import com.vivo.push.sdk.OpenClientPushMessageReceiver; |
| | | import com.weikou.beibeivideo.ui.SplashActivity; |
| | | import com.xiaomi.mipush.sdk.ErrorCode; |
| | | import com.xiaomi.mipush.sdk.MiPushClient; |
| | | import com.xiaomi.mipush.sdk.MiPushCommandMessage; |
| | | import com.xiaomi.mipush.sdk.MiPushMessage; |
| | | import com.xiaomi.mipush.sdk.PushMessageReceiver; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class VIVOPushMessageReceiver extends OpenClientPushMessageReceiver { |
| | | public static MiPushMessage miPushMessage = null; |
| | | |
| | | @Override |
| | | public void onReceiveRegId(Context context, String regId) { |
| | | super.onReceiveRegId(context, regId); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.weikou.beibeivideo.receiver; |
| | | |
| | | import android.app.Activity; |
| | | import android.app.ActivityManager; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.util.Log; |
| | | |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | import com.weikou.beibeivideo.ui.SplashActivity; |
| | | import com.weikou.beibeivideo.util.downutil.StringUtils; |
| | | import com.xiaomi.mipush.sdk.ErrorCode; |
| | | import com.xiaomi.mipush.sdk.MiPushClient; |
| | | import com.xiaomi.mipush.sdk.MiPushCommandMessage; |
| | | import com.xiaomi.mipush.sdk.MiPushMessage; |
| | | import com.xiaomi.mipush.sdk.PushMessageReceiver; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class XMPushMessageReceiver extends PushMessageReceiver { |
| | | |
| | | private String TAG = XMPushMessageReceiver.class.getSimpleName(); |
| | | |
| | | public static MiPushMessage miPushMessage = null; |
| | | |
| | | @Override |
| | | public void onReceivePassThroughMessage(Context context, MiPushMessage message) { |
| | | message.getContent(); |
| | | } |
| | | |
| | | @Override |
| | | public void onNotificationMessageClicked(Context context, MiPushMessage message) { |
| | | Log.i(TAG, "onNotificationMessageClicked"); |
| | | if (!isAppRunning(context, context.getPackageName())) { |
| | | miPushMessage = message; |
| | | Intent intent = new Intent(context, SplashActivity.class); |
| | | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | context.startActivity(intent); |
| | | } else { |
| | | startActivity(context, null, message); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onNotificationMessageArrived(Context context, MiPushMessage msg) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) { |
| | | String command = message.getCommand(); |
| | | List<String> arguments = message.getCommandArguments(); |
| | | String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null); |
| | | if (MiPushClient.COMMAND_REGISTER.equals(command)) { |
| | | Log.i("mResult", "注册结果码--" + message.getResultCode()); |
| | | if (message.getResultCode() == ErrorCode.SUCCESS) { |
| | | Log.i("mResult", "注册成功"); |
| | | String mRegId = cmdArg1; |
| | | Log.i(TAG, mRegId); |
| | | if (!StringUtils.isNullOrEmpty(mRegId)) { |
| | | |
| | | BeibeiVideoAPI.pushBindToken(context, "xm", mRegId, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | |
| | | } |
| | | },false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void startActivity(Context context, Activity activity, MiPushMessage message) { |
| | | |
| | | } |
| | | |
| | | public boolean isAppRunning(Context context, String packageName) { |
| | | Log.i("mResult", "isAppRunning()"); |
| | | ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
| | | List<ActivityManager.RunningTaskInfo> list = am.getRunningTasks(100); |
| | | boolean isAppRunning = false; |
| | | //100表示取的最大的任务数,info.topActivity表示当前正在运行的Activity,info.baseActivity表系统后台有此进程在运行 |
| | | for (ActivityManager.RunningTaskInfo info : list) { |
| | | if (info.topActivity.getPackageName().equals(packageName) || info.baseActivity.getPackageName().equals(packageName)) { |
| | | isAppRunning = true; |
| | | Log.i("ActivityService isRun()", info.topActivity.getPackageName() + " info.baseActivity.getPackageName()=" + info.baseActivity.getPackageName()); |
| | | break; |
| | | } |
| | | } |
| | | Log.i("ActivityService isRun()", "com.ad 程序 ...isAppRunning......" + isAppRunning); |
| | | return isAppRunning; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.weikou.beibeivideo.service; |
| | | |
| | | import android.content.Intent; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | import com.huawei.hms.push.HmsMessageService; |
| | | import com.huawei.hms.push.RemoteMessage; |
| | | import com.huawei.hms.push.SendException; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | public class HWPushService extends HmsMessageService { |
| | | |
| | | private static final String TAG = "HWPushService"; |
| | | private final static String CODELABS_ACTION = "com.huawei.codelabpush.action"; |
| | | |
| | | @Override |
| | | public void onCreate() { |
| | | Log.i(TAG, "onCreate"); |
| | | super.onCreate(); |
| | | } |
| | | |
| | | /** |
| | | * When an app calls the getToken method to apply for a token from the server, |
| | | * if the server does not return the token during current method calling, the server can return the token through this method later. |
| | | * This method callback must be completed in 10 seconds. Otherwise, you need to start a new Job for callback processing. |
| | | * |
| | | * @param token token |
| | | */ |
| | | @Override |
| | | public void onNewToken(String token) { |
| | | BeibeiVideoAPI.pushBindToken(getApplicationContext(), "hw", token, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | |
| | | } |
| | | },true); |
| | | } |
| | | |
| | | private void refreshedTokenToServer(String token) { |
| | | Log.i(TAG, "sending token to server. token:" + token); |
| | | } |
| | | |
| | | /** |
| | | * This method is used to receive downstream data messages. |
| | | * This method callback must be completed in 10 seconds. Otherwise, you need to start a new Job for callback processing. |
| | | * |
| | | * @param message RemoteMessage |
| | | */ |
| | | @Override |
| | | public void onMessageReceived(RemoteMessage message) { |
| | | Log.i(TAG, "onMessageReceived is called"); |
| | | if (message == null) { |
| | | Log.e(TAG, "Received message entity is null!"); |
| | | return; |
| | | } |
| | | // getCollapseKey() Obtains the classification identifier (collapse key) of a message. |
| | | // getData() Obtains valid content data of a message. |
| | | // getMessageId() Obtains the ID of a message. |
| | | // getMessageType() Obtains the type of a message. |
| | | // getNotification() Obtains the notification data instance from a message. |
| | | // getOriginalUrgency() Obtains the original priority of a message. |
| | | // getSentTime() Obtains the time when a message is sent from the server. |
| | | // getTo() Obtains the recipient of a message. |
| | | |
| | | Log.i(TAG, "getCollapseKey: " + message.getCollapseKey() |
| | | + "\n getData: " + message.getData() |
| | | + "\n getFrom: " + message.getFrom() |
| | | + "\n getTo: " + message.getTo() |
| | | + "\n getMessageId: " + message.getMessageId() |
| | | + "\n getMessageType: " + message.getMessageType() |
| | | + "\n getSendTime: " + message.getSentTime() |
| | | + "\n getTtl: " + message.getTtl() |
| | | + "\n getSendMode: " + message.getSendMode() |
| | | + "\n getReceiptMode: " + message.getReceiptMode() |
| | | + "\n getOriginalUrgency: " + message.getOriginalUrgency() |
| | | + "\n getUrgency: " + message.getUrgency() |
| | | + "\n getToken: " + message.getToken()); |
| | | |
| | | // getBody() Obtains the displayed content of a message |
| | | // getTitle() Obtains the title of a message |
| | | // getTitleLocalizationKey() Obtains the key of the displayed title of a notification message |
| | | // getTitleLocalizationArgs() Obtains variable parameters of the displayed title of a message |
| | | // getBodyLocalizationKey() Obtains the key of the displayed content of a message |
| | | // getBodyLocalizationArgs() Obtains variable parameters of the displayed content of a message |
| | | // getIcon() Obtains icons from a message |
| | | // getSound() Obtains the sound from a message |
| | | // getTag() Obtains the tag from a message for message overwriting |
| | | // getColor() Obtains the colors of icons in a message |
| | | // getClickAction() Obtains actions triggered by message tapping |
| | | // getChannelId() Obtains IDs of channels that support the display of messages |
| | | // getImageUrl() Obtains the image URL from a message |
| | | // getLink() Obtains the URL to be accessed from a message |
| | | // getNotifyId() Obtains the unique ID of a message |
| | | |
| | | RemoteMessage.Notification notification = message.getNotification(); |
| | | if (notification != null) { |
| | | Log.i(TAG, "\n getTitle: " + notification.getTitle() |
| | | + "\n getTitleLocalizationKey: " + notification.getTitleLocalizationKey() |
| | | + "\n getTitleLocalizationArgs: " + Arrays.toString(notification.getTitleLocalizationArgs()) |
| | | + "\n getBody: " + notification.getBody() |
| | | + "\n getBodyLocalizationKey: " + notification.getBodyLocalizationKey() |
| | | + "\n getBodyLocalizationArgs: " + Arrays.toString(notification.getBodyLocalizationArgs()) |
| | | + "\n getIcon: " + notification.getIcon() |
| | | + "\n getImageUrl: " + notification.getImageUrl() |
| | | + "\n getSound: " + notification.getSound() |
| | | + "\n getTag: " + notification.getTag() |
| | | + "\n getColor: " + notification.getColor() |
| | | + "\n getClickAction: " + notification.getClickAction() |
| | | + "\n getIntentUri: " + notification.getIntentUri() |
| | | + "\n getChannelId: " + notification.getChannelId() |
| | | + "\n getLink: " + notification.getLink() |
| | | + "\n getNotifyId: " + notification.getNotifyId() |
| | | + "\n isDefaultLight: " + notification.isDefaultLight() |
| | | + "\n isDefaultSound: " + notification.isDefaultSound() |
| | | + "\n isDefaultVibrate: " + notification.isDefaultVibrate() |
| | | + "\n getWhen: " + notification.getWhen() |
| | | + "\n getLightSettings: " + Arrays.toString(notification.getLightSettings()) |
| | | + "\n isLocalOnly: " + notification.isLocalOnly() |
| | | + "\n getBadgeNumber: " + notification.getBadgeNumber() |
| | | + "\n isAutoCancel: " + notification.isAutoCancel() |
| | | + "\n getImportance: " + notification.getImportance() |
| | | + "\n getTicker: " + notification.getTicker() |
| | | + "\n getVibrateConfig: " + Arrays.toString(notification.getVibrateConfig()) |
| | | + "\n getVisibility: " + notification.getVisibility()); |
| | | } |
| | | |
| | | Intent intent = new Intent(); |
| | | intent.setAction(CODELABS_ACTION); |
| | | intent.putExtra("method", "onMessageReceived"); |
| | | intent.putExtra("msg", "onMessageReceived called, message id:" + message.getMessageId() + ", payload data:" |
| | | + message.getData()); |
| | | |
| | | sendBroadcast(intent); |
| | | |
| | | Boolean judgeWhetherIn10s = false; |
| | | |
| | | // If the messages are not processed in 10 seconds, the app needs to use WorkManager for processing. |
| | | if (judgeWhetherIn10s) { |
| | | startWorkManagerJob(message); |
| | | } else { |
| | | // Process message within 10s |
| | | processWithin10s(message); |
| | | } |
| | | } |
| | | |
| | | private void startWorkManagerJob(RemoteMessage message) { |
| | | Log.d(TAG, "Start new Job processing."); |
| | | } |
| | | |
| | | private void processWithin10s(RemoteMessage message) { |
| | | Log.d(TAG, "Processing now."); |
| | | } |
| | | |
| | | @Override |
| | | public void onMessageSent(String msgId) { |
| | | Log.i(TAG, "onMessageSent called, Message id:" + msgId); |
| | | Intent intent = new Intent(); |
| | | intent.setAction(CODELABS_ACTION); |
| | | intent.putExtra("method", "onMessageSent"); |
| | | intent.putExtra("msg", "onMessageSent called, Message id:" + msgId); |
| | | |
| | | sendBroadcast(intent); |
| | | } |
| | | |
| | | @Override |
| | | public void onSendError(String msgId, Exception exception) { |
| | | Log.i(TAG, "onSendError called, message id:" + msgId + ", ErrCode:" |
| | | + ((SendException) exception).getErrorCode() + ", description:" + exception.getMessage()); |
| | | |
| | | Intent intent = new Intent(); |
| | | intent.setAction(CODELABS_ACTION); |
| | | intent.putExtra("method", "onSendError"); |
| | | intent.putExtra("msg", "onSendError called, message id:" + msgId + ", ErrCode:" |
| | | + ((SendException) exception).getErrorCode() + ", description:" + exception.getMessage()); |
| | | |
| | | sendBroadcast(intent); |
| | | } |
| | | |
| | | @Override |
| | | public void onTokenError(Exception e) { |
| | | super.onTokenError(e); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | if (!this.isTaskRoot()) {// 判断本activity是不是任务空间的源activity,false就是不是系统重新实例化出来的 |
| | | finish(); |
| | | return; |
| | | } |
| | | // if (!this.isTaskRoot()) {// 判断本activity是不是任务空间的源activity,false就是不是系统重新实例化出来的 |
| | | // finish(); |
| | | // return; |
| | | // } |
| | | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | setContentView(R.layout.activity_splash); |
| | | initStatusBar(); |
| | |
| | | GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN3 = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN2 = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTConstant.PID_HOME_RECOMMEND_BIG_IMG = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | GDTConstant.PID_2_VIDEO_DETAIL_PLAYER_PRE_PPTV = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | |
| | | CSJConstant.RECOMMEND_BIG_IMG_AD = CSJConstant.INVALID_AD; |
| | | } |
| | |
| | | //百度内容联盟 |
| | | // MobadsPermissionSettings.setPermissionReadDeviceID(true); |
| | | getUid(); |
| | | new WebView(this); |
| | | vg_ad.postDelayed(new Runnable() { |
| | | |
| | | @Override |
| | |
| | | if (jsonObject.optBoolean("IsPost")) { |
| | | //绑定成功 |
| | | Toast.makeText(PhoneLoginActivity.this, "绑定成功", Toast.LENGTH_SHORT).show(); |
| | | mPhoneNumberAuthHelper.quitLoginPage(); |
| | | PhoneLoginActivity.this.finish(); |
| | | } else { |
| | | Toast.makeText(PhoneLoginActivity.this, jsonObject.optString("Error"), Toast.LENGTH_SHORT).show(); |
| | |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | DialogUtil.dismiss(loadingDialog); |
| | | mPhoneNumberAuthHelper.quitLoginPage(); |
| | | } |
| | | }); |
| | | |
| | |
| | | import android.support.v4.content.Loader; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.RadioButton; |
| | | import android.widget.RadioGroup; |
| | | import android.widget.TextView; |
| | |
| | | import com.umeng.socialize.media.UMImage; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | import com.weikou.beibeivideo.BeibeiVideoApplication; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.db.MessageTable; |
| | | import com.weikou.beibeivideo.entity.NewComment; |
| | |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.baidu.BaiDuNewsFragment; |
| | | import com.weikou.beibeivideo.ui.baidu.BaiDuVideosFragment; |
| | | import com.weikou.beibeivideo.ui.dialog.LoadingDialogUtil; |
| | | import com.weikou.beibeivideo.ui.login.LoginActivity; |
| | | import com.weikou.beibeivideo.ui.login.PersonInfoActivity; |
| | | import com.weikou.beibeivideo.ui.login.PhoneLoginActivity; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity2; |
| | | import com.weikou.beibeivideo.ui.mine.BrowserActivity; |
| | | import com.weikou.beibeivideo.ui.mine.SystemMessageActivity; |
| | | import com.weikou.beibeivideo.ui.mine.WatchHistoryActivity; |
| | | import com.weikou.beibeivideo.ui.push.PushOpenClickActivity; |
| | | import com.weikou.beibeivideo.ui.recommend.SearchActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.ExitDialog; |
| | |
| | | WifiManager wifi = (WifiManager) this.getApplicationContext().getSystemService(Context.WIFI_SERVICE); |
| | | WifiInfo info = wifi.getConnectionInfo(); |
| | | |
| | | Editor editor = mPre.edit(); |
| | | if (StringUtils.isEmpty(getMacAddress())) { |
| | | editor.putString("mac", info.getMacAddress()); |
| | | } else { |
| | | editor.putString("mac", getMacAddress()); |
| | | } |
| | | editor.commit(); |
| | | try { |
| | | Editor editor = mPre.edit(); |
| | | if (StringUtils.isEmpty(getMacAddress())) { |
| | | editor.putString("mac", info.getMacAddress()); |
| | | } else { |
| | | editor.putString("mac", getMacAddress()); |
| | | } |
| | | editor.commit(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | tv_search = findViewById(R.id.tv_activity_main_search); |
| | | |
| | | iv_msg_dot = findViewById(R.id.iv_msg_dot); |
| | |
| | | addDownloadBuxin(preferences.getString("shopurl", "")); |
| | | } |
| | | EventBus.getDefault().register(this); |
| | | |
| | | PushOpenClickActivity.resumeJumpActivity(this); |
| | | } |
| | | |
| | | |
| | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class PPTVPlayFragment extends RetainViewFragment implements OnClickListener { |
| | | private final static int REQUEST_CODE_LOGIN = 1001; |
| | | |
| | |
| | | |
| | | private boolean showAd = true; |
| | | |
| | | private void getPPVideoInfo(String url) { |
| | | if (url.contains("cid=") && url.contains("vid=")) { |
| | | String[] sts = url.split("\\?"); |
| | | if (sts.length > 1) { |
| | | String params = sts[1]; |
| | | String[] ps = params.split("&"); |
| | | Map<String, String> map = new HashMap<>(); |
| | | for (String p : ps) { |
| | | map.put(p.split("=")[0], p.split("=")[1]); |
| | | } |
| | | String cid = map.get("cid"); |
| | | String vid = map.get("vid"); |
| | | //PPTV播放上传 |
| | | BeibeiVideoAPI.uploadPPTVPlayRecord(getContext(), cid, vid, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void initWebView(View view) { |
| | | fl_ad = view.findViewById(R.id.fl_ad); |
| | | webview = view.findViewById(R.id.webview); |
| | | webview.setWebViewClient(new WebViewClient() { |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
| | | Log.i(TAG, "shouldOverrideUrlLoading:" + url); |
| | | if (url != null && (!url.startsWith("http"))) { |
| | | return true; |
| | | } |
| | | |
| | | try { |
| | | getPPVideoInfo(url); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return super.shouldOverrideUrlLoading(view, url); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onPageFinished(WebView webView, String s) { |
| | |
| | | webSetting.setJavaScriptEnabled(true); |
| | | webSetting.setTextZoom(100); |
| | | webSetting.setBlockNetworkImage(false); |
| | | if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) { |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| | | webSetting.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); |
| | | } |
| | | webview.addJavascriptInterface(new PPJavaInterface(BeibeiVideoApplication.application, new PPJavaInterface.IEventListener() { |
| | |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.tv_top_bar_left: { |
| | | |
| | | if (getActivity().getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { |
| | | if (webview != null) |
| | | webview.loadUrl("javascript:exitFullScreenPlay();"); |
| | | getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | WindowManager.LayoutParams attrs = getActivity().getWindow().getAttributes(); |
| | | attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; |
| | |
| | | } else { |
| | | getActivity().finish(); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case R.id.iv_add_to_favourite: |
New file |
| | |
| | | package com.weikou.beibeivideo.ui.push; |
| | | |
| | | import android.app.Activity; |
| | | import android.app.ActivityManager; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebViewClient; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.alibaba.baichuan.android.trade.AlibcTrade; |
| | | import com.alibaba.baichuan.android.trade.AlibcTradeSDK; |
| | | import com.alibaba.baichuan.android.trade.callback.AlibcTradeCallback; |
| | | import com.alibaba.baichuan.android.trade.model.AlibcShowParams; |
| | | import com.alibaba.baichuan.android.trade.model.OpenType; |
| | | import com.alibaba.baichuan.trade.biz.applink.adapter.AlibcFailModeType; |
| | | import com.alibaba.baichuan.trade.biz.context.AlibcTradeResult; |
| | | import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams; |
| | | import com.ut.device.UTDevice; |
| | | import com.weikou.beibeivideo.ui.SplashActivity; |
| | | import com.weikou.beibeivideo.ui.main.MainActivity; |
| | | import com.weikou.beibeivideo.util.AlibcTradeUtil; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.downutil.StringUtils; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by jiguang on 17/7/5. |
| | | */ |
| | | |
| | | public class PushOpenClickActivity extends Activity { |
| | | |
| | | public static PushData pushData = null; |
| | | |
| | | private static final String TAG = "OpenClickActivity"; |
| | | private TextView mTextView; |
| | | |
| | | |
| | | private static void jump(Activity context, String type, String activity, String params) throws ClassNotFoundException, JSONException { |
| | | pushData = null; |
| | | Log.i(TAG,String.format("%s:%s:%s",type,activity,params)); |
| | | if (!"baichuan".equalsIgnoreCase(type)) { |
| | | Intent intent = new Intent(context, Class.forName(activity)); |
| | | if (!StringUtils.isNullOrEmpty(params)) { |
| | | JSONObject paramsJson = new JSONObject(params); |
| | | for (Iterator<String> its = paramsJson.keys(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | String value = paramsJson.getString(key); |
| | | intent.putExtra(key, value); |
| | | } |
| | | } |
| | | context.startActivity(intent); |
| | | } else { |
| | | JSONObject paramsJson = new JSONObject(params); |
| | | String url = paramsJson.optString("url"); |
| | | AlibcShowParams alibcShowParams = new AlibcShowParams(); |
| | | alibcShowParams.setOpenType(OpenType.Auto); |
| | | alibcShowParams.setNativeOpenFailedMode(AlibcFailModeType.AlibcNativeFailModeJumpBROWER); |
| | | AlibcTaokeParams alibcTaokeParams = new AlibcTaokeParams("", "", ""); |
| | | alibcTaokeParams.setPid(BeibeiConstant.BAICHUAN_PID); |
| | | alibcTaokeParams.setAdzoneid(BeibeiConstant.BAICHUAN_ADZONE_ID); |
| | | alibcTaokeParams.pid = BeibeiConstant.BAICHUAN_PID; |
| | | alibcTaokeParams.adzoneid = BeibeiConstant.BAICHUAN_ADZONE_ID; |
| | | alibcTaokeParams.extraParams = new HashMap<>(); |
| | | alibcTaokeParams.extraParams.put("taokeAppkey", BeibeiConstant.BAICHUAN_APPKEY); |
| | | |
| | | AlibcTradeSDK.setTaokeParams(alibcTaokeParams); |
| | | AlibcTradeUtil.openByUrl(context, |
| | | url, null, new WebViewClient(), new WebChromeClient(), |
| | | alibcShowParams, alibcTaokeParams, null); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | mTextView = new TextView(this); |
| | | setContentView(mTextView); |
| | | String activity = getIntent().getStringExtra("activity"); |
| | | String params = getIntent().getStringExtra("params"); |
| | | String type = getIntent().getStringExtra("type"); |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append("activity:" + activity); |
| | | builder.append("\n"); |
| | | builder.append("params:" + params); |
| | | mTextView.setText(builder.toString()); |
| | | if (!isAppRunning(getApplicationContext(), getPackageName())) { |
| | | //暂存数据 |
| | | pushData = new PushData(type, activity, params); |
| | | Intent intent = new Intent(this, MainActivity.class); |
| | | startActivity(intent); |
| | | finish(); |
| | | } else { |
| | | try { |
| | | jump(this, type, activity, params); |
| | | finish(); |
| | | } catch (ClassNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | private boolean isAppRunning(Context context, String packageName) { |
| | | ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); |
| | | ActivityManager.RunningTaskInfo info = manager.getRunningTasks(1).get(0); |
| | | Log.i(TAG, "numActivities:" + info.numActivities); |
| | | Log.i(TAG, "numRunning:" + info.numRunning); |
| | | |
| | | if (info.numActivities < 2) |
| | | return false; |
| | | else |
| | | return true; |
| | | } |
| | | |
| | | public static void resumeJumpActivity(Activity context) { |
| | | if (pushData != null) { |
| | | try { |
| | | jump(context, pushData.type, pushData.getActivity(), pushData.getParams()); |
| | | } catch (ClassNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | class PushData { |
| | | private String activity; |
| | | private String params; |
| | | //activity,baichuan |
| | | private String type; |
| | | |
| | | public PushData(String type,String activity, String params) { |
| | | this.activity = activity; |
| | | this.params = params; |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getActivity() { |
| | | return activity; |
| | | } |
| | | |
| | | public void setActivity(String activity) { |
| | | this.activity = activity; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | albumVideoHolder.tv_name.setText(info.getName() + ""); |
| | | albumVideoHolder.tv_type.setText(info.getTag()); |
| | | albumVideoHolder.tv_actors.setText(info.getMainActor()); |
| | | if (info.getFree() == 1) { |
| | | albumVideoHolder.iv_vip.setVisibility(View.VISIBLE); |
| | | } else { |
| | | albumVideoHolder.iv_vip.setVisibility(View.GONE); |
| | | } |
| | | |
| | | |
| | | albumVideoHolder.tv_play.setOnClickListener(new View.OnClickListener() { |
| | |
| | | } |
| | | simpleVideoHolder.tv_movie_title.setText(info.getName() + ""); |
| | | |
| | | if (info.getFree() == 1) { |
| | | simpleVideoHolder.iv_vip.setVisibility(View.VISIBLE); |
| | | } else { |
| | | simpleVideoHolder.iv_vip.setVisibility(View.GONE); |
| | | } |
| | | |
| | | if (!StringUtils.isBlank(info.getTag())) |
| | | simpleVideoHolder.tv_tag.setText(info.getTag()); |
| | |
| | | class AlbumVideoHolder extends RecyclerView.ViewHolder { |
| | | |
| | | ImageView iv_picture; |
| | | ImageView iv_vip; |
| | | TextView tv_name; |
| | | TextView tv_type; |
| | | TextView tv_actors; |
| | |
| | | tv_video_3 = view.findViewById(R.id.tv_video_3); |
| | | tv_video_4 = view.findViewById(R.id.tv_video_4); |
| | | tv_video_5 = view.findViewById(R.id.tv_video_5); |
| | | iv_vip = view.findViewById(R.id.iv_vip); |
| | | } |
| | | } |
| | | |
| | | class SimpleVideoHolder extends RecyclerView.ViewHolder { |
| | | ImageView iv_movie_cover; |
| | | ImageView iv_vip; |
| | | |
| | | TextView tv_movie_title, tv_tag; |
| | | View view; |
| | | |
| | |
| | | iv_movie_cover = view.findViewById(R.id.iv_movie_cover); |
| | | tv_movie_title = view.findViewById(R.id.tv_movie_title); |
| | | tv_tag = view.findViewById(R.id.tv_tag); |
| | | iv_vip = view.findViewById(R.id.iv_vip); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public static final String ABOUT_US = "http://bwweb.yeshitv.com/abountOur/index.html"; |
| | | |
| | | public static final String HOST = "http://cb.ysdq.yeshitv.com";//正式上线版本 |
| | | public static final String HOST = "http://api.ysdq.yeshitv.com:8089";//正式上线版本 |
| | | |
| | | |
| | | public static final String BAICHUAN_APPKEY = "24980167"; |
| | |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.view.View; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.entity.UserInfo; |
| | | import com.weikou.beibeivideo.entity.vo.UserInfoVO; |
| | | import com.weikou.beibeivideo.util.downutil.StringUtils; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | |
| | | import static android.content.Context.MODE_PRIVATE; |
| | | |
| | |
| | | return false; |
| | | else |
| | | return true; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.net.URLEncoder; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | |
| | | |
| | | dependencies { |
| | | classpath 'com.android.tools.build:gradle:4.1.1' |
| | | classpath 'com.huawei.agconnect:agcp:1.2.1.301' |
| | | classpath 'com.huawei.agconnect:agcp:1.4.1.300' |
| | | } |
| | | } |
| | | |
| | |
| | | import android.content.Context; |
| | | import android.content.pm.ApplicationInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | import java.util.Iterator; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2018/7/26. |
| | | */ |
| | | |
| | | public class ManifestDataUtil { |
| | | private static final String TAG ="ManifestDataUtil" ; |
| | | |
| | | /** |
| | | * 获取application中指定的meta-data。本例中,调用方法时key就是UMENG_CHANNEL |
| | | * |
| | | * @return 如果没有获取成功(没有对应值,或者异常),则返回值为空 |
| | | * @return 如果没有获取成功(没有对应值 , 或者异常),则返回值为空 |
| | | */ |
| | | public static String getAppMetaData(Context ctx, String key) { |
| | | if (ctx == null || TextUtils.isEmpty(key)) { |
| | |
| | | resultData = applicationInfo.metaData.getString(key); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } catch (PackageManager.NameNotFoundException e) { |
| | | e.printStackTrace(); |
New file |
| | |
| | | apply plugin: 'com.android.library' |
| | | |
| | | android { |
| | | compileSdkVersion 29 |
| | | buildToolsVersion "29.0.0" |
| | | |
| | | defaultConfig { |
| | | minSdkVersion 17 |
| | | targetSdkVersion 27 |
| | | versionCode 1 |
| | | versionName "1.0" |
| | | |
| | | consumerProguardFiles 'consumer-rules.pro' |
| | | } |
| | | |
| | | |
| | | buildTypes { |
| | | release { |
| | | minifyEnabled false |
| | | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| | | } |
| | | } |
| | | compileOptions { |
| | | sourceCompatibility JavaVersion.VERSION_1_8 |
| | | targetCompatibility JavaVersion.VERSION_1_8 |
| | | } |
| | | } |
| | | |
| | | dependencies { |
| | | api 'com.huawei.hms:push:5.0.4.302' |
| | | api files('libs\\com.heytap.msp.aar') |
| | | api files('libs\\MiPush_SDK_Client_3_8_5.jar') |
| | | api files('libs\\vivo_pushsdk_v3.0.0.0_480.aar') |
| | | api 'com.meizu.flyme.internet:push-internal:4.0.4' |
| | | |
| | | implementation project(path: ':library-common') |
| | | } |
File was renamed from library-jpush/proguard-rules.pro |
| | |
| | | |
| | | # If you keep the line number information, uncomment this to |
| | | # hide the original source file name. |
| | | #-renamesourcefileattribute SourceFile |
| | | #-renamesourcefileattribute SourceFile |
New file |
| | |
| | | package com.yeshi.ec.push; |
| | | |
| | | import android.content.Context; |
| | | import android.support.test.InstrumentationRegistry; |
| | | import android.support.test.runner.AndroidJUnit4; |
| | | |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | |
| | | import static org.junit.Assert.*; |
| | | |
| | | /** |
| | | * Instrumented test, which will execute on an Android device. |
| | | * |
| | | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| | | */ |
| | | @RunWith(AndroidJUnit4.class) |
| | | public class ExampleInstrumentedTest { |
| | | @Test |
| | | public void useAppContext() { |
| | | // Context of the app under test. |
| | | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); |
| | | assertEquals("com.yeshi.ec.library_push.test", appContext.getPackageName()); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:tools="http://schemas.android.com/tools" |
| | | package="com.yeshi.ec.push"> |
| | | |
| | | <uses-sdk |
| | | tools:ignore="MultipleUsesSdk" |
| | | tools:overrideLibrary="com.heytap.mcssdk" /> |
| | | |
| | | <!-- 小米推送权限 --> |
| | | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
| | | <uses-permission android:name="android.permission.INTERNET" /> |
| | | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| | | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| | | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| | | <uses-permission android:name="android.permission.VIBRATE" /> |
| | | |
| | | <permission |
| | | android:name="${applicationId}.permission.MIPUSH_RECEIVE" |
| | | android:protectionLevel="signature" /> |
| | | |
| | | <uses-permission android:name="${applicationId}.permission.MIPUSH_RECEIVE" /> |
| | | |
| | | <!--OPPO推送权限 --> |
| | | <!-- 如果应用无透传权限,则不用配置--> |
| | | <!-- <uses-permission android:name="com.coloros.mcs.permission.RECIEVE_MCS_MESSAGE" />--> |
| | | <!-- <uses-permission android:name="com.heytap.mcs.permission.RECIEVE_MCS_MESSAGE" />--> |
| | | |
| | | <!-- 魅族推送权限 --> |
| | | |
| | | <!-- 兼容 Flyme5 的权限配置--> |
| | | <uses-permission android:name="com.meizu.flyme.push.permission.RECEIVE" /> |
| | | <uses-permission android:name="com.meizu.flyme.permission.PUSH" /> |
| | | <permission |
| | | android:name="${applicationId}.push.permission.MESSAGE" |
| | | android:protectionLevel="signature" /> |
| | | <uses-permission android:name="${applicationId}.push.permission.MESSAGE" /> |
| | | <!-- 兼容 Flyme3 的权限配置--> |
| | | <uses-permission android:name="com.meizu.c2dm.permission.RECEIVE" /> |
| | | <permission |
| | | android:name="${applicationId}.permission.C2D_MESSAGE" |
| | | android:protectionLevel="signature" /> |
| | | <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" /> |
| | | |
| | | |
| | | <application> |
| | | |
| | | |
| | | <!-- 小米推送 --> |
| | | <service |
| | | android:name="com.xiaomi.push.service.XMPushService" |
| | | android:enabled="true" |
| | | android:process=":pushservice" /> |
| | | |
| | | <!--注:此service必须在3.0.1版本以后(包括3.0.1版本)加入--> |
| | | <service |
| | | android:name="com.xiaomi.push.service.XMJobService" |
| | | android:enabled="true" |
| | | android:exported="false" |
| | | android:permission="android.permission.BIND_JOB_SERVICE" |
| | | android:process=":pushservice" /> |
| | | |
| | | <service |
| | | android:name="com.xiaomi.mipush.sdk.PushMessageHandler" |
| | | android:enabled="true" |
| | | android:exported="true" /> |
| | | |
| | | <!--注:此service必须在2.2.5版本以后(包括2.2.5版本)加入--> |
| | | <service |
| | | android:name="com.xiaomi.mipush.sdk.MessageHandleService" |
| | | android:enabled="true" /> |
| | | |
| | | <receiver |
| | | android:name="com.xiaomi.push.service.receivers.NetworkStatusReceiver" |
| | | android:exported="true"> |
| | | <intent-filter> |
| | | <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> |
| | | <category android:name="android.intent.category.DEFAULT" /> |
| | | </intent-filter> |
| | | </receiver> |
| | | |
| | | <receiver |
| | | android:name="com.xiaomi.push.service.receivers.PingReceiver" |
| | | android:exported="false" |
| | | android:process=":pushservice"> |
| | | <intent-filter> |
| | | <action android:name="com.xiaomi.push.PING_TIMER" /> |
| | | </intent-filter> |
| | | </receiver> |
| | | |
| | | |
| | | |
| | | <!--Vivo Push需要配置的service、activity--> |
| | | <service |
| | | android:name="com.vivo.push.sdk.service.CommandClientService" |
| | | android:exported="true" |
| | | android:permission="com.push.permission.UPSTAGESERVICE" /> |
| | | |
| | | |
| | | </application> |
| | | |
| | | </manifest> |
New file |
| | |
| | | package com.yeshi.push; |
| | | |
| | | import android.app.ActivityManager; |
| | | import android.app.Application; |
| | | import android.content.Context; |
| | | import android.os.Build; |
| | | import android.os.Process; |
| | | import android.util.Log; |
| | | |
| | | import com.heytap.msp.push.HeytapPushManager; |
| | | import com.heytap.msp.push.callback.ICallBackResultService; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.meizu.cloud.pushsdk.PushManager; |
| | | import com.vivo.push.IPushActionListener; |
| | | import com.vivo.push.PushClient; |
| | | import com.xiaomi.mipush.sdk.MiPushClient; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class PushUtil { |
| | | |
| | | static String TAG = "PushUtil"; |
| | | |
| | | /** |
| | | * 推送 注册 |
| | | */ |
| | | public static void inintPush(Application context, ITokenListener tokenListener) { |
| | | if (context != null) { |
| | | String xmRegId = null; |
| | | switch (Build.BRAND.toLowerCase()) { |
| | | case "huawei": |
| | | case "honor": |
| | | //华为是自动初始化 |
| | | return; |
| | | case "oppo"://上面官方判断 |
| | | /***OPPO官方判断方法*/ |
| | | HeytapPushManager.init(context, true); |
| | | if (HeytapPushManager.isSupportPush()) { |
| | | String appKey = ManifestDataUtil.getAppMetaData(context, "OPPO_APPKEY").replace("OPPO-", ""); |
| | | String appSecret = ManifestDataUtil.getAppMetaData(context, "OPPO_APPSECRET").replace("OPPO-", ""); |
| | | HeytapPushManager.register(context, appKey, appSecret, new ICallBackResultService() { |
| | | |
| | | @Override |
| | | public void onRegister(int i, String s) { |
| | | //注册成功 |
| | | Log.i(TAG, "OPPO注册结果:" + i); |
| | | Log.i(TAG, "OPPO注册成功:" + s); |
| | | if (i == 0) { |
| | | tokenListener.onToken("oppo", s); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onUnRegister(int i) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSetPushTime(int i, String s) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onGetPushStatus(int i, int i1) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onGetNotificationStatus(int i, int i1) { |
| | | |
| | | } |
| | | }); |
| | | HeytapPushManager.requestNotificationPermission(); |
| | | return; |
| | | } |
| | | break; |
| | | case "vivo"://上面官方判断 |
| | | /***VIVO官方判断方法**/ |
| | | // 在当前工程入口函数,建议在 Application 的 onCreate 函数中,添加以下代码: |
| | | PushClient.getInstance(context).initialize(); |
| | | if (PushClient.getInstance(context).isSupport()) { |
| | | //并且打开推送服务 |
| | | PushClient.getInstance(context).turnOnPush(new IPushActionListener() { |
| | | @Override |
| | | public void onStateChanged(int i) { |
| | | if (i == 0) { |
| | | String regId = PushClient.getInstance(context).getRegId(); |
| | | Log.i(TAG, "VIVO注册成功:" + regId); |
| | | tokenListener.onToken("vivo", regId); |
| | | } |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | break; |
| | | case "meizu"://魅族 |
| | | { |
| | | String appId = ManifestDataUtil.getAppMetaData(context, "MEIZU_APPID").replace("MEIZU-", ""); |
| | | String appKey = ManifestDataUtil.getAppMetaData(context, "MEIZU_APPKEY").replace("MEIZU-", ""); |
| | | PushManager.register(context, appId, appKey); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | String appId = ManifestDataUtil.getAppMetaData(context, "XIAOMI_APPID").replace("XIAOMI-", ""); |
| | | String appKey = ManifestDataUtil.getAppMetaData(context, "XIAOMI_APPKEY").replace("XIAOMI-", ""); |
| | | MiPushClient.registerPush(context, appId, appKey);//注册小米推送 |
| | | xmRegId = MiPushClient.getRegId(context); |
| | | Log.i(TAG, "小米注册成功:" + xmRegId); |
| | | if (!StringUtils.isEmpty(xmRegId)) { |
| | | tokenListener.onToken("xm", xmRegId); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | public interface ITokenListener { |
| | | public void onToken(String romType, String regId); |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.ec.push; |
| | | |
| | | import org.junit.Test; |
| | | |
| | | import static org.junit.Assert.*; |
| | | |
| | | /** |
| | | * Example local unit test, which will execute on the development machine (host). |
| | | * |
| | | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| | | */ |
| | | public class ExampleUnitTest { |
| | | @Test |
| | | public void addition_isCorrect() { |
| | | assertEquals(4, 2 + 2); |
| | | } |
| | | } |
| | |
| | | include ':library-push' |
| | | include ':library-BaiduCPU' |
| | | include ':library-VideoPlayer' |
| | | include ':library-GDTSDK' |
| | |
| | | include ':library-DownloadProvider' |
| | | include ':library-common' |
| | | include ':library-APPUpdate' |
| | | include ':library-jpush' |
| | | include ':BuWanVideo' |