Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
apk_product
/
ForFun
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
a8be5b38
...
a8be5b38dd58983a04a1994c148decd94517a467
authored
2020-04-15 14:17:53 +0800
by
金学艇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改程序退出调用方法,js调用java端的onExitApp,然后才能正常调用埋点SDK
1 parent
7a7c4eae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
16 deletions
assets/Script/common/TVCanvas.js
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/AppActivity.java
assets/Script/common/TVCanvas.js
View file @
a8be5b3
...
...
@@ -365,7 +365,10 @@ cc.Topdraw.TVCanvas =
this
.
showDetainBox
();
}
else
{
cc
.
log
(
"退出应用5!"
);
self
.
commonSimpleTip
(
"正在退出..."
,
3000
,
0
,
-
320
);
self
.
commonSimpleTip
(
"正在退出..."
,
3000
,
0
,
-
320
);
if
(
cc
.
sys
.
isNative
)
{
//通知福建移动埋点SDK退出应用
jsb
.
reflection
.
callStaticMethod
(
"org/cocos2dx/javascript/AppActivity"
,
"onExitApp"
,
"()V"
);
}
setTimeout
(
function
()
{
cc
.
game
.
end
();
}.
bind
(
this
),
3500
);
//延时销毁可以让福建移动埋点SDK发送出去
...
...
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/AppActivity.java
View file @
a8be5b3
...
...
@@ -30,6 +30,7 @@ import org.cocos2dx.javascript.component.NativeLogReporterNewTV;
import
org.cocos2dx.javascript.component.NewTVSDK
;
import
org.cocos2dx.lib.Cocos2dxActivity
;
import
org.cocos2dx.lib.Cocos2dxGLSurfaceView
;
import
android.app.AlertDialog
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
...
...
@@ -52,6 +53,7 @@ import android.webkit.JavascriptInterface;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.knowyou_jni.single.SDKUtil
;
import
com.topdraw.forfun_FJYD.R
;
import
com.topdraw.sdk.ITopdrawResultListener
;
...
...
@@ -60,6 +62,7 @@ import com.topdraw.sdk.TopdrawSDK;
import
java.net.URLEncoder
;
import
java.util.HashMap
;
import
org.cocos2dx.javascript.component.CocosMediaPlayer
;
import
org.cocos2dx.javascript.common.CommonUtils
;
import
org.cocos2dx.javascript.common.MelodyApplication
;
...
...
@@ -236,23 +239,28 @@ public class AppActivity extends Cocos2dxActivity {
@Override
protected
void
onDestroy
()
{
Log
.
d
(
"AppActivity"
,
"onDestroy()...."
);
unregisterReceiver
(
receiver
);
super
.
onDestroy
();
SDKWrapper
.
getInstance
().
onDestroy
();
}
public
static
void
onExitApp
()
{
Log
.
d
(
TAG
,
"onExitApp..."
);
//未来SDK退出
NativeLogReporterNewTV
nlp
=
NativeLogReporterNewTV
.
getInstance
(
this
,
null
);
NativeLogReporterNewTV
nlp
=
NativeLogReporterNewTV
.
getInstance
(
getContext
()
,
null
);
nlp
.
report
(
88
,
"1"
);
unregisterReceiver
(
receiver
);
SDKWrapper
.
getInstance
().
onDestroy
();
// if (baminSDKInited) { //埋点SDK退出--
// HashMap<Object, Object> params = new HashMap<>();
// params.put("APP_NAME", APP_NAME);
// params.put("APP_TYPE", APP_TYPE);
// params.put("USER_LOGIN", "0");
// params.put("USER_ID", USER_ID);
// params.put("USER_ORDER", NativeSystem.isAuthenticated ? "已订购" : "未订购");
// SDKUtil.getInstance().ky_trackCustom(params);
// SDKUtil.getInstance().ky_userSignOut(USER_ID);
// }
TopdrawSDK
.
destory
(
this
,
null
,
new
ITopdrawResultListener
()
{
if
(
baminSDKInited
)
{
//埋点SDK退出--
HashMap
<
Object
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"APP_NAME"
,
APP_NAME
);
params
.
put
(
"APP_TYPE"
,
APP_TYPE
);
params
.
put
(
"USER_LOGIN"
,
"0"
);
params
.
put
(
"USER_ID"
,
USER_ID
);
params
.
put
(
"USER_ORDER"
,
NativeSystem
.
isAuthenticated
?
"已订购"
:
"未订购"
);
SDKUtil
.
getInstance
().
ky_trackCustom
(
params
);
SDKUtil
.
getInstance
().
ky_userSignOut
(
USER_ID
);
}
TopdrawSDK
.
destory
(
getContext
(),
null
,
new
ITopdrawResultListener
()
{
@Override
public
void
onResult
(
int
i
,
String
s
,
Object
o
)
{
Log
.
d
(
TAG
,
"destory "
+
i
+
" "
+
s
);
...
...
@@ -262,7 +270,6 @@ public class AppActivity extends Cocos2dxActivity {
}
System
.
exit
(
0
);
}
catch
(
Throwable
t
)
{
}
}
});
...
...
Please
register
or
sign in
to post a comment