Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
5a2a1032
Commit
5a2a1032
authored
Feb 25, 2022
by
sheteng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推送
parent
657a6ce9
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
190 additions
and
16 deletions
+190
-16
app/build.gradle.kts
app/build.gradle.kts
+8
-15
app/proguard-rules.pro
app/proguard-rules.pro
+10
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+28
-1
app/src/main/java/com/ccwangluo/accelerator/App.kt
app/src/main/java/com/ccwangluo/accelerator/App.kt
+2
-0
app/src/main/java/com/ccwangluo/accelerator/receiver/MyXGPushBaseReceiver.kt
...om/ccwangluo/accelerator/receiver/MyXGPushBaseReceiver.kt
+54
-0
app/src/main/java/com/ccwangluo/accelerator/ui/MainActivity.kt
...rc/main/java/com/ccwangluo/accelerator/ui/MainActivity.kt
+18
-0
app/src/main/res/layout/xg_notification.xml
app/src/main/res/layout/xg_notification.xml
+70
-0
No files found.
app/build.gradle.kts
View file @
5a2a1032
...
@@ -22,21 +22,13 @@ android {
...
@@ -22,21 +22,13 @@ android {
}
}
}
}
// compileSdk 30
// compileSdk 30
// defaultConfig {
defaultConfig
{
// applicationId = "com.ccwangluo.accelerator"
applicationId
=
"com.ccwangluo.accelerator"
// minSdk 21
testInstrumentationRunner
=
"androidx.test.runner.AndroidJUnitRunner"
// targetSdk 30
// versionCode = 1
manifestPlaceholders
.
put
(
"XG_ACCESS_ID"
,
"1580009634"
)
// versionName = "1.0"
manifestPlaceholders
.
put
(
"XG_ACCESS_KEY"
,
"AIJKAIYR3WPS"
)
//
}
// testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// javaCompileOptions {
// annotationProcessor(Options {)
// arguments = listOf( moduleName : project.getName() )
// }
// }
// manifestPlaceholders = listOf(qqappid = "你的qq appid")
// }
buildTypes
{
buildTypes
{
named
(
"release"
){
named
(
"release"
){
...
@@ -120,4 +112,5 @@ dependencies {
...
@@ -120,4 +112,5 @@ dependencies {
annotationProcessor
(
"com.github.bumptech.glide:compiler:4.11.0"
)
annotationProcessor
(
"com.github.bumptech.glide:compiler:4.11.0"
)
implementation
(
"com.github.open-android:JieCaoVideoPlayer:0.1.0"
)
implementation
(
"com.github.open-android:JieCaoVideoPlayer:0.1.0"
)
implementation
(
"com.tencent.tpns:tpns:1.3.2.0-release"
)
}
}
\ No newline at end of file
app/proguard-rules.pro
View file @
5a2a1032
...
@@ -165,3 +165,13 @@
...
@@ -165,3 +165,13 @@
-
dontwarn
org
.
eclipse
.
jdt
.
annotation
.
**
-
dontwarn
org
.
eclipse
.
jdt
.
annotation
.
**
-
dontwarn
c
.
t
.
**
-
dontwarn
c
.
t
.
**
-
keep
public
class
*
extends
android
.
app
.
Service
-
keep
public
class
*
extends
android
.
content
.
BroadcastReceiver
-
keep
class
com
.
tencent
.
android
.
tpush
.
**
{
*
;}
-
keep
class
com
.
tencent
.
tpns
.
baseapi
.
**
{
*
;}
-
keep
class
com
.
tencent
.
tpns
.
mqttchannel
.
**
{
*
;}
-
keep
class
com
.
tencent
.
tpns
.
dataacquisition
.
**
{
*
;}
-
keep
class
com
.
tencent
.
bigdata
.
baseapi
.
**
{
*
;}
//
1.2
.
0.1
及以上版本不需要此条配置
-
keep
class
com
.
tencent
.
bigdata
.
mqttchannel
.
**
{
*
;}
//
1.2
.
0.1
及以上版本不需要此条配置
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
5a2a1032
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
package=
"com.ccwangluo.accelerator"
>
package=
"com.ccwangluo.accelerator"
>
<!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
<permission
android:name=
"com.ccwangluo.accelerator.permission.XGPUSH_RECEIVE"
android:protectionLevel=
"signature"
/>
<uses-permission
android:name=
"com.ccwangluo.accelerator.permission.XGPUSH_RECEIVE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
...
@@ -17,9 +23,9 @@
...
@@ -17,9 +23,9 @@
<uses-permission
android:name=
"android.permission.BLUETOOTH"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH_ADMIN"
/>
<!-- 支持A-GPS辅助定位 -->
<uses-permission
android:name=
"android.permission.BLUETOOTH_ADMIN"
/>
<!-- 支持A-GPS辅助定位 -->
<uses-permission
android:name=
"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
/>
<!-- 用于 log 日志 -->
<uses-permission
android:name=
"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
/>
<!-- 用于 log 日志 -->
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<queries>
<queries>
<package
android:name=
"com.tencent.mm"
/>
<package
android:name=
"com.tencent.mm"
/>
<package
android:name=
"com.tencent.mobileqq"
/>
<package
android:name=
"com.tencent.mobileqq"
/>
...
@@ -34,6 +40,7 @@
...
@@ -34,6 +40,7 @@
<package
android:name=
"com.tencent.mm"
/>
<package
android:name=
"com.tencent.mm"
/>
<package
android:name=
"com.goplaycn.googleinstall"
/>
<package
android:name=
"com.goplaycn.googleinstall"
/>
<package
android:name=
"io.kkzs"
/>
<package
android:name=
"io.kkzs"
/>
<package
android:name=
"com.eg.android.AlipayGphone"
/>
</queries>
</queries>
...
@@ -68,6 +75,26 @@
...
@@ -68,6 +75,26 @@
android:name=
"TencentMapSDK"
android:name=
"TencentMapSDK"
android:value=
"KZFBZ-QJ26J-WAYFC-FIO5N-FE453-QTFTT"
/>
android:value=
"KZFBZ-QJ26J-WAYFC-FIO5N-FE453-QTFTT"
/>
<meta-data
android:name=
"XG_SERVER_SUFFIX"
android:value=
"tpns.sh.tencent.com"
/>
<uses-library
android:name=
"org.apache.http.legacy"
android:required=
"false"
/>
<receiver
android:name=
".receiver.MyXGPushBaseReceiver"
>
<intent-filter>
<!-- 接收消息透传 -->
<action
android:name=
"com.tencent.android.xg.vip.action.PUSH_MESSAGE"
/>
<!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
<action
android:name=
"com.tencent.android.xg.vip.action.FEEDBACK"
/>
</intent-filter>
</receiver>
<!-- 在自身应用的AndroidManifest.xml文件中添加如下结点,其中 xxx 为任意自定义名称: -->
<!-- 关闭与 TPNS 应用的联合保活功能,请配置 -->
<provider
android:name=
"com.tencent.android.tpush.XGPushProvider"
tools:replace=
"android:authorities"
android:authorities=
"com.ccwangluo.accelerator.ccwangluo.XGVIP_PUSH_AUTH"
android:exported=
"false"
/>
<activity
<activity
android:name=
".wxapi.WXEntryActivity"
android:name=
".wxapi.WXEntryActivity"
android:configChanges=
"keyboardHidden|orientation|screenSize"
android:configChanges=
"keyboardHidden|orientation|screenSize"
...
...
app/src/main/java/com/ccwangluo/accelerator/App.kt
View file @
5a2a1032
...
@@ -8,6 +8,7 @@ import com.ccwangluo.accelerator.ui.MainActivity
...
@@ -8,6 +8,7 @@ import com.ccwangluo.accelerator.ui.MainActivity
import
com.ccwangluo.accelerator.utils.PhoneUtils
import
com.ccwangluo.accelerator.utils.PhoneUtils
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.Core
import
com.hjq.toast.ToastUtils
import
com.hjq.toast.ToastUtils
import
com.tencent.android.tpush.XGPushConfig
import
com.tencent.map.geolocation.TencentLocationManager
import
com.tencent.map.geolocation.TencentLocationManager
import
com.tencent.mmkv.MMKV
import
com.tencent.mmkv.MMKV
import
com.xuexiang.xpage.PageConfig
import
com.xuexiang.xpage.PageConfig
...
@@ -28,6 +29,7 @@ class App : Application(), androidx.work.Configuration.Provider by Core {
...
@@ -28,6 +29,7 @@ class App : Application(), androidx.work.Configuration.Provider by Core {
MultiDex
.
install
(
this
)
MultiDex
.
install
(
this
)
Core
.
init
(
this
,
MainActivity
::
class
)
Core
.
init
(
this
,
MainActivity
::
class
)
MMKV
.
initialize
(
this
)
MMKV
.
initialize
(
this
)
XGPushConfig
.
enableDebug
(
this
,
true
);
}
}
override
fun
onConfigurationChanged
(
newConfig
:
Configuration
)
{
override
fun
onConfigurationChanged
(
newConfig
:
Configuration
)
{
...
...
app/src/main/java/com/ccwangluo/accelerator/receiver/MyXGPushBaseReceiver.kt
0 → 100644
View file @
5a2a1032
package
com.ccwangluo.accelerator.receiver
import
android.content.Context
import
com.tencent.android.tpush.*
class
MyXGPushBaseReceiver
:
XGPushBaseReceiver
(){
override
fun
onRegisterResult
(
p0
:
Context
?,
p1
:
Int
,
p2
:
XGPushRegisterResult
?)
{
}
override
fun
onUnregisterResult
(
p0
:
Context
?,
p1
:
Int
)
{
}
override
fun
onSetTagResult
(
p0
:
Context
?,
p1
:
Int
,
p2
:
String
?)
{
}
override
fun
onDeleteTagResult
(
p0
:
Context
?,
p1
:
Int
,
p2
:
String
?)
{
}
override
fun
onSetAccountResult
(
p0
:
Context
?,
p1
:
Int
,
p2
:
String
?)
{
}
override
fun
onDeleteAccountResult
(
p0
:
Context
?,
p1
:
Int
,
p2
:
String
?)
{
}
override
fun
onSetAttributeResult
(
p0
:
Context
?,
p1
:
Int
,
p2
:
String
?)
{
}
override
fun
onQueryTagsResult
(
p0
:
Context
?,
p1
:
Int
,
p2
:
String
?,
p3
:
String
?)
{
}
override
fun
onDeleteAttributeResult
(
p0
:
Context
?,
p1
:
Int
,
p2
:
String
?)
{
}
override
fun
onTextMessage
(
p0
:
Context
?,
p1
:
XGPushTextMessage
?)
{
}
override
fun
onNotificationClickedResult
(
p0
:
Context
?,
p1
:
XGPushClickedResult
?)
{
}
override
fun
onNotificationShowedResult
(
p0
:
Context
?,
p1
:
XGPushShowedResult
?)
{
}
}
\ No newline at end of file
app/src/main/java/com/ccwangluo/accelerator/ui/MainActivity.kt
View file @
5a2a1032
...
@@ -32,11 +32,18 @@ import com.xuexiang.xpage.core.PageOption
...
@@ -32,11 +32,18 @@ import com.xuexiang.xpage.core.PageOption
import
android.hardware.SensorManager
import
android.hardware.SensorManager
import
android.hardware.SensorEventListener
import
android.hardware.SensorEventListener
import
android.os.Handler
import
android.os.Handler
import
android.util.Log
import
com.ccwangluo.accelerator.utils.SysUtils
import
com.ccwangluo.accelerator.utils.SysUtils
import
com.xuexiang.xutil.net.NetworkUtils
import
com.xuexiang.xutil.net.NetworkUtils
import
com.xuexiang.xutil.system.PermissionUtils
import
com.xuexiang.xutil.system.PermissionUtils
import
fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
import
fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
import
java.security.Permission
import
java.security.Permission
import
com.tencent.android.tpush.XGIOperateCallback
import
com.tencent.android.tpush.XGPushManager
class
MainActivity
()
:
XPageActivity
(),
TencentLocationListener
{
class
MainActivity
()
:
XPageActivity
(),
TencentLocationListener
{
...
@@ -112,6 +119,17 @@ class MainActivity() : XPageActivity(), TencentLocationListener {
...
@@ -112,6 +119,17 @@ class MainActivity() : XPageActivity(), TencentLocationListener {
private
fun
initPhoneUtils
()
{
private
fun
initPhoneUtils
()
{
PhoneUtils
.
getPhoneInfo
()
PhoneUtils
.
getPhoneInfo
()
//腾讯推送
XGPushManager
.
registerPush
(
this
,
object
:
XGIOperateCallback
{
override
fun
onSuccess
(
data
:
Any
,
flag
:
Int
)
{
//token在设备卸载重装的时候有可能会变
Log
.
d
(
"TPush"
,
"注册成功,设备token为:$data"
)
}
override
fun
onFail
(
data
:
Any
,
errCode
:
Int
,
msg
:
String
)
{
Log
.
d
(
"TPush"
,
"注册失败,错误码:$errCode,错误信息:$msg"
)
}
})
}
}
override
fun
onBackPressed
()
{
override
fun
onBackPressed
()
{
...
...
app/src/main/res/layout/xg_notification.xml
0 → 100644
View file @
5a2a1032
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/xg_root_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<!--通知的背景,id名字不能改变,其他可变-->
<ImageView
android:id=
"@+id/xg_notification_bg"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"centerCrop"
/>
<!--通知的大图标,id名字不能改变,其他可变.必须-->
<ImageView
android:id=
"@+id/xg_notification_icon"
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:layout_alignParentLeft=
"true"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"5dp"
android:scaleType=
"centerInside"
/>
<!--通知的时间,id名字不能改变,其他可变.若不显示时间可以去掉此布局-->
<TextView
android:id=
"@+id/xg_notification_date"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentTop=
"true"
android:layout_alignParentRight=
"true"
android:layout_marginTop=
"5dp"
android:layout_marginRight=
"5dp"
android:textSize=
"12dp"
/>
<!--通知的标题,id名字不能改变,其他可变。必须-->
<TextView
android:id=
"@+id/xg_notification_style_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"20dp"
android:layout_toLeftOf=
"@id/xg_notification_date"
android:layout_toRightOf=
"@id/xg_notification_icon"
android:singleLine=
"true"
/>
<!--通知的内容,id名字不能改变,其他可变。必须-->
<TextView
android:id=
"@+id/xg_notification_style_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/xg_notification_style_title"
android:layout_alignLeft=
"@+id/xg_notification_style_title"
android:layout_marginTop=
"1dp"
android:layout_toLeftOf=
"@id/xg_notification_date"
android:singleLine=
"true"
/>
<!--带音频的富媒体通知的音频播放按钮,id名字不能改变,其他可变。若没用到音频富媒体可以去掉此布局-->
<ImageView
android:id=
"@+id/xg_notification_audio_play"
android:layout_width=
"25dp"
android:layout_height=
"25dp"
android:layout_alignLeft=
"@+id/xg_notification_style_title"
android:layout_alignParentBottom=
"true"
android:background=
"@android:drawable/ic_media_play"
android:visibility=
"gone"
/>
<!--带音频的富媒体通知的音频停止播放按钮,id名字不能改变,其他可变.若没用到音频富媒体可以去掉此布局-->
<ImageView
android:id=
"@+id/xg_notification_audio_stop"
android:layout_width=
"25dp"
android:layout_height=
"25dp"
android:layout_alignParentBottom=
"true"
android:layout_marginLeft=
"30dp"
android:layout_toRightOf=
"@+id/xg_notification_audio_play"
android:background=
"@android:drawable/ic_media_pause"
android:visibility=
"gone"
/>
</RelativeLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment