新增h5功能
This commit is contained in:
@@ -274,36 +274,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
|
||||
};
|
||||
|
||||
// private void getToken() {
|
||||
// // 创建一个新线程
|
||||
// new Thread() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// try {
|
||||
// // 从agconnect-service.json文件中读取appId
|
||||
// String appId = "106936673";
|
||||
//
|
||||
// // 输入token标识"HCM"
|
||||
// String tokenScope = "HCM";
|
||||
// String token = HmsInstanceId.getInstance(MainActivity.this).getToken(appId, tokenScope);
|
||||
// Log.i("hw", "get token: " + token);
|
||||
//
|
||||
// // 判断token是否为空
|
||||
// if(!TextUtils.isEmpty(token)) {
|
||||
// sendRegTokenToServer(token);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// Log.e("hw","get token failed, " + e);
|
||||
// }
|
||||
// }
|
||||
// }.start();
|
||||
// }
|
||||
// private void sendRegTokenToServer(String token) {
|
||||
// PushManager.getInstance()
|
||||
// .onReceiveToken(MainActivity.this, PushType.HUAWEI, token);
|
||||
// Log.i("hw", "sending token to server. token:" + token);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
|
||||
@@ -160,6 +160,39 @@ public class RewardActivity extends AbsActivity {
|
||||
|
||||
//js调用原生
|
||||
public class JsInteration {
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidClickToNewH5PageView(String url) {
|
||||
url = CommonAppConfig.HOST + url;
|
||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken();
|
||||
Log.i("tag", url);
|
||||
Intent intent = new Intent(mContext, ZhuangBanActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
intent.putExtra("isFull", false);
|
||||
mContext.startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 新跳转
|
||||
*
|
||||
* @param url 跳转的url
|
||||
* @param title 有标题的展示标题
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public void androidClickToNewH5PageView(String url, String title) {
|
||||
url = CommonAppConfig.HOST + url;
|
||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken();
|
||||
Log.i("tag", url);
|
||||
Intent intent = new Intent(mContext, ZhuangBanActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
intent.putExtra("isFull", false);
|
||||
intent.putExtra("title", title);
|
||||
mContext.startActivity(intent);
|
||||
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void androidZBan(String svg) {
|
||||
String[] arr = svg.split("/");
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 235 KiB After Width: | Height: | Size: 313 KiB |
Reference in New Issue
Block a user