Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
polysoft-nafmii
/
polysoft-android
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e612f0ee
authored
Sep 28, 2021
by
amateur
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
23dee85a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
0 deletions
app/src/main/AndroidManifest.xml
app/src/main/java/com/whaty/nafmii/uat/wxapi/WXEntryActivity.java
app/src/main/java/com/whaty/nafmii/uat/wxapi/WXPayEntryActivity.java
app/src/main/AndroidManifest.xml
View file @
e612f0e
...
@@ -83,6 +83,17 @@
...
@@ -83,6 +83,17 @@
android:exported=
"true"
android:exported=
"true"
android:launchMode=
"singleTask"
android:launchMode=
"singleTask"
android:taskAffinity=
"${applicationId}"
/>
android:taskAffinity=
"${applicationId}"
/>
<!-- 微信UAT环境-->
<activity
android:name=
"com.whaty.nafmii.uat.wxapi.WXEntryActivity"
android:exported=
"true"
android:launchMode=
"singleTask"
android:taskAffinity=
"${applicationId}"
/>
<activity
android:name=
"com.whaty.nafmii.uat.wxapi.WXPayEntryActivity"
android:exported=
"true"
android:launchMode=
"singleTask"
android:taskAffinity=
"${applicationId}"
/>
<service
<service
android:name=
"com.tencent.smtt.export.external.DexClassLoaderProviderService"
android:name=
"com.tencent.smtt.export.external.DexClassLoaderProviderService"
...
...
app/src/main/java/com/whaty/nafmii/uat/wxapi/WXEntryActivity.java
0 → 100644
View file @
e612f0e
package
com
.
whaty
.
nafmii
.
uat
.
wxapi
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
com.polysoft.nafmii.broadcast.ShareReceiver
;
import
com.polysoft.nafmii.wechat.ShareResult
;
import
com.polysoft.nafmii.wechat.WechatApi
;
import
com.tencent.mm.opensdk.modelbase.BaseReq
;
import
com.tencent.mm.opensdk.modelbase.BaseResp
;
import
com.tencent.mm.opensdk.modelmsg.SendAuth
;
import
com.tencent.mm.opensdk.openapi.IWXAPIEventHandler
;
public
class
WXEntryActivity
extends
Activity
implements
IWXAPIEventHandler
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
WechatApi
.
getInstance
(
this
).
handleIntent
(
getIntent
(),
this
);
}
@Override
protected
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
setIntent
(
intent
);
WechatApi
.
getInstance
(
this
).
handleIntent
(
intent
,
this
);
}
@Override
public
void
onReq
(
BaseReq
baseReq
)
{
}
@Override
public
void
onResp
(
BaseResp
resp
)
{
if
(
resp
instanceof
SendAuth
.
Resp
)
{
}
int
code
=
resp
.
errCode
;
if
(
code
==
BaseResp
.
ErrCode
.
ERR_OK
)
{
// 分享成功
ShareReceiver
.
sendBroadcast
(
this
,
ShareResult
.
shareSuccess
());
}
else
if
(
code
==
BaseResp
.
ErrCode
.
ERR_USER_CANCEL
)
{
// 用户取消
ShareReceiver
.
sendBroadcast
(
this
,
ShareResult
.
shareCancel
());
}
else
{
// 分享失败
String
errStr
=
resp
.
errStr
;
ShareReceiver
.
sendBroadcast
(
this
,
ShareResult
.
shareFail
(
errStr
));
}
super
.
finish
();
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
}
}
app/src/main/java/com/whaty/nafmii/uat/wxapi/WXPayEntryActivity.java
0 → 100644
View file @
e612f0e
package
com
.
whaty
.
nafmii
.
uat
.
wxapi
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.util.Log
;
import
com.polysoft.nafmii.wechat.WechatApi
;
import
com.tencent.mm.opensdk.constants.ConstantsAPI
;
import
com.tencent.mm.opensdk.modelbase.BaseReq
;
import
com.tencent.mm.opensdk.modelbase.BaseResp
;
import
com.tencent.mm.opensdk.openapi.IWXAPI
;
import
com.tencent.mm.opensdk.openapi.IWXAPIEventHandler
;
public
class
WXPayEntryActivity
extends
Activity
implements
IWXAPIEventHandler
{
private
static
final
String
TAG
=
WXPayEntryActivity
.
class
.
getName
();
private
IWXAPI
api
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
WechatApi
.
getInstance
(
this
).
handleIntent
(
getIntent
(),
this
);
}
@Override
protected
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
setIntent
(
intent
);
WechatApi
.
getInstance
(
this
).
handleIntent
(
intent
,
this
);
}
@Override
public
void
onReq
(
BaseReq
req
)
{
}
@Override
public
void
onResp
(
BaseResp
resp
)
{
Log
.
d
(
TAG
,
"onPayFinish, errCode = "
+
resp
.
errCode
);
if
(
resp
.
getType
()
!=
ConstantsAPI
.
COMMAND_PAY_BY_WX
)
{
return
;
}
int
code
=
resp
.
errCode
;
if
(
code
==
BaseResp
.
ErrCode
.
ERR_OK
)
{
// 支付成功
// PayReceiver.sendBroadcast(this, PayResult.success(PayMode.WECHATPAY, null));
}
else
if
(
code
==
BaseResp
.
ErrCode
.
ERR_USER_CANCEL
)
{
// 用户取消
// PayReceiver.sendBroadcast(this, PayResult.cancel(PayMode.WECHATPAY));
}
else
{
// 支付失败
String
errStr
=
resp
.
errStr
;
// PayReceiver.sendBroadcast(this, PayResult.fail(PayMode.WECHATPAY, errStr));
}
super
.
finish
();
}
}
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment