Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PushPlatformDemo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengjunjing
PushPlatformDemo
Commits
5c987827
Commit
5c987827
authored
Jun 08, 2021
by
pengjunjign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:将所有推送SDK的初始化改在子线程执行
parent
273a73e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
MyApplication.kt
...src/main/java/com/laihua/pushtestproject/MyApplication.kt
+13
-2
build.gradle
build.gradle
+3
-3
MyClass.java
...lib/src/main/java/com/laihua/vivopushtestlib/MyClass.java
+2
-3
No files found.
app/src/main/java/com/laihua/pushtestproject/MyApplication.kt
View file @
5c987827
package
com.laihua.pushtestproject
import
android.app.Application
import
android.content.Intent
import
android.net.Uri
import
android.util.Log
import
com.laihua.push.PushManager
import
com.laihua.push.platform.InitParam
import
com.laihua.push.utils.LogUtils
...
...
@@ -11,9 +14,17 @@ import com.laihua.push.utils.LogUtils
* Description:
*/
class
MyApplication
:
Application
()
{
private
val
TAG
=
"MyApplication"
override
fun
onCreate
()
{
super
.
onCreate
()
val
intent
=
Intent
(
this
,
MainActivity
::
class
.
java
)
intent
.
setData
(
Uri
.
parse
(
"vpushscheme://com.vivo.push.notifysdk/detail?"
))
intent
.
putExtra
(
"key1"
,
"xxx"
)
val
toUri
=
intent
.
toUri
(
Intent
.
URI_INTENT_SCHEME
)
Log
.
i
(
TAG
,
"onCreate: $toUri"
)
PushManager
.
instance
.
initContext
(
this
)
//vivo的配置信息直接在manifest配置,华为的配置信息在agconnect-services.json文件
val
autoInitPushSdk
=
PushManager
.
instance
.
autoInitPushSdk
(
...
...
@@ -21,7 +32,7 @@ class MyApplication : Application() {
InitParam
(
"220c8dc643ce4a709b116a0aa26e6bf4"
,
"0305238c1c6949c38caa1fdd8070b4aa"
),
InitParam
(
"2882303761519924093"
,
"5121992433093"
),
InitParam
(
"141361"
,
"f3e78d580c7d46c295263b3dde94ca72"
),
{
{
platform
,
it
->
LogUtils
.
i
(
"推送SDK初始化成功:$it"
)
PushManager
.
instance
.
addTopic
(
"test_topic"
)
PushManager
.
instance
.
setAlias
(
"test_alias"
)
...
...
build.gradle
View file @
5c987827
...
...
@@ -5,16 +5,16 @@ import java.text.SimpleDateFormat
buildscript
{
ext
.
kotlin_version
=
'1.3.72'
repositories
{
maven
{
url
'https://developer.huawei.com/repo/'
}
jcenter
()
google
()
mavenCentral
()
maven
{
url
'https://developer.huawei.com/repo/'
}
}
dependencies
{
classpath
"com.android.tools.build:gradle:4.2.1"
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath
'com.huawei.agconnect:agcp:1.3.1.300'
//
classpath 'com.huawei.agconnect:agcp:1.3.1.300'
classpath
'com.huawei.agconnect:agcp:1.4.2.300'
classpath
"org.jfrog.buildinfo:build-info-extractor-gradle:4.15.2"
...
...
@@ -23,10 +23,10 @@ buildscript {
allprojects
{
repositories
{
maven
{
url
'https://developer.huawei.com/repo/'
}
jcenter
()
google
()
mavenCentral
()
maven
{
url
'https://developer.huawei.com/repo/'
}
}
}
...
...
vivoPushTestlib/src/main/java/com/laihua/vivopushtestlib/MyClass.java
View file @
5c987827
...
...
@@ -7,13 +7,12 @@ import com.vivo.push.sdk.server.Sender;
public
class
MyClass
{
public
static
void
main
(
String
[]
args
)
{
try
{
//推送测试,运行之后可以直接在手机上收到推送.
Sender
sender
=
new
Sender
(
"ccb2170d-3ded-499b-9779-f1a904edd98d"
);
Result
result
=
sender
.
getToken
(
105483822
,
"cca2ba3da947c84ca7544e78237fca1c"
);
sender
.
setAuthToken
(
result
.
getAuthToken
());
Message
singleMessage
=
new
Message
.
Builder
()
//将此id改为手机注册成功之后的id,可能需要在vivo后台添加为测试设备
.
regId
(
"162
14127740408382238160
"
)
// .regId("16214127740408382238160")
.
regId
(
"162
26277681096597195561
"
)
.
notifyType
(
3
)
.
title
(
"push title test1111"
)
.
content
(
"push content test 22222"
)
...
...
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