el=""> 154
                String webURL = MainApplication.url + "/zhannew/basic/web/index.php/discount/redlist?userid=" + MainApplication.userId + "&token=" + token;
155
                intent.putExtra("url", webURL);
156
                context.startActivity(intent);
157
                MobclickAgent.onEvent(context, "0808");
158
            } catch (Exception e) {
159
                e.printStackTrace();
160
            }
161
        } else if ("PushWeb".equals(type) && !TextUtils.isEmpty(url)) {
162
            intent = new Intent(context, MyWebViewActivity.class);
163
            intent.putExtra("url", url);
164
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
165
            context.startActivity(intent);
166
        } else if ("PushComment".equals(type)) {
167
            intent = new Intent(context, MyMessageActivity.class);
168
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
169
            context.startActivity(intent);
170
        } else if ("PushBalance".equals(type) && MainApplication.isLogin()) {
171
            intent = new Intent(context, MyBalanceActivity.class);
172
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
173
            context.startActivity(intent);
174
        } else if ("PushRanking".equals(type) && MainApplication.isLogin()) {
175
            intent = new Intent(context, RankingListActivity.class);
176
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
177
            context.startActivity(intent);
178
        } else if ("PushRecharge".equals(type) && MainApplication.isLogin()) {
179
            intent = new Intent(context, AccountRechargeActivity.class);
180
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
181
            context.startActivity(intent);
182
        } else if ("PushInvite".equals(type) && MainApplication.isLogin()) {
183
            intent = new Intent(context, MyWebViewActivity.class);
184
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
185
            intent.putExtra("url", "https://evcharge.cc/cdz/yqm.html?code=" + UserCenterActivity.getShareNo(Integer.parseInt(MainApplication.userId)) + "&phone=" + MainApplication.userPhone);
186
            context.startActivity(intent);
187
        } else if (("first".equals(type) || "second".equals(type) || "three".equals(type)) && MainApplication.isLogin()) {
188
            long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
189
            try {
190
                String token = DES3.encode(String.valueOf(tokenTime));
191
                token = URLEncoder.encode(token, "UTF-8");
192
                intent = new Intent(context, MyWebViewActivity.class);
193
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
194
                String webURL = MainApplication.url + "/zhannew/basic/web/index.php/discount/redlist?userid=" + MainApplication.userId + "&token=" + token;
195
                intent.putExtra("url", webURL);
196
                context.startActivity(intent);
197
            } catch (Exception e) {
198
                e.printStackTrace();
199
            }
200
        } else {
201
            intent = new Intent(context, MainMapActivity.class);
202
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
203
            context.startActivity(intent);
204
        }
205
    }
206
}

+ 9 - 0
app/src/main/java/com/electric/chargingpile/manager/ProfileManager.java

@ -69,6 +69,7 @@ public class ProfileManager {
69 69
    private static final String KEY_CLICKED_USER_PUBLISH_ROLE = "key_clicked_user_publish_role";
70 70
    private static final String KEY_MAKE_SURE_NETWORK_FOR_VIDEO = "key_make_sure_network_for_video";
71 71
    private static final String KEY_DEVICE_ID = "key_device_id";
72
    private static final String KEY_PUSH_ID = "key_push_id";
72 73

73 74
    private static ProfileManager instance;
74 75
    private String deviceId;
@ -643,4 +644,12 @@ public class ProfileManager {
643 644
    public void setMsgChargingStatusNo(Context context, int id) {
644 645
        PreferenceManager.getInstance(context).putInt(KEY_MESSAGE_STATUS_CHARGING_NO, id);
645 646
    }
647

648
    public void setPushID(Context context, String pushID) {
649
        PreferenceManager.getInstance(context).putString(KEY_PUSH_ID, pushID);
650
    }
651

652
    public String getPushID(Context context) {
653
        return PreferenceManager.getInstance(context).getString(KEY_PUSH_ID, "");
654
    }
646 655
}

+ 0 - 181
app/src/main/java/com/electric/chargingpile/view/MyReceiver.java

@ -1,181 +0,0 @@
1
package com.electric.chargingpile.view;
2
3
import android.content.BroadcastReceiver;
4
import android.content.Context;
5
import android.content.Intent;
6
import android.os.Bundle;
7
import android.util.Log;
8
9
import com.electric.chargingpile.activity.MainActicity;
10
import com.electric.chargingpile.activity.MainMapActivity;
11
import com.electric.chargingpile.activity.MyWebViewActivity;
12
import com.electric.chargingpile.activity.WelcomeActivity;
13
import com.electric.chargingpile.application.MainApplication;
14
import com.electric.chargingpile.util.DES3;
15
import com.electric.chargingpile.util.ExampleUtil;
16
import com.umeng.analytics.MobclickAgent;
17
18
import org.json.JSONException;
19
import org.json.JSONObject;
20
21
import java.net.URLEncoder;
22
import java.util.Iterator;
23
24
import cn.jpush.android.api.JPushInterface;
25
26
/**
27
 * 自定义接收器
28
 * <p>
29
 * 如果不定义这个 Receiver,则:
30
 * 1) 默认用户会打开主界面
31
 * 2) 接收不到自定义消息
32
 */
33
public class MyReceiver extends BroadcastReceiver {
34
    private static final String TAG = "JPush";
35
36
    @Override
37
    public void onReceive(Context context, Intent intent) {
38
        Bundle bundle = intent.getExtras();
39
        Log.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
40
41
        if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
42
            String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
43
            Log.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
44
            //send the Registration Id to your server...
45
46
        } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
47
            Log.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
48
            processCustomMessage(context, bundle);
49
50
        } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
51
            Log.d(TAG, "[MyReceiver] 接收到推送下来的通知");
52
            int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
53
            JPushInterface.reportNotificationOpened(context, bundle.getString(JPushInterface.EXTRA_MSG_ID));
54
            Log.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
55
            String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);//获取附加字段,是一个json数组
56
            Log.e("extra:", extras);
57
58
        } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
59
            Log.d(TAG, "[MyReceiver] 用户点击打开了通知");
60
61
//			openNotification(context,bundle);
62
            String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);//获取附加字段,是一个json数组
63
            Log.e("extra:", extras);
64
65
            JSONObject json = null;
66
            try {
67
                json = new JSONObject(extras);
68
            } catch (JSONException e) {
69
                e.printStackTrace();
70
            }
71
            //进行json.getString("Article")操作时,要保证这里的Article与服务器上的Article一模一样,不然回报空指针异常
72
            String articleUrl = "";//获取附加字段Article,对应的值为articleUrl
73
            String type = "";
74
            try {
75
                articleUrl = json.getString("customUrl");
76
                type = json.getString("type");
77
78
//				if (type.equals("PushWeb")){
79
                MainApplication.h5_url = articleUrl;
80
                MainApplication.type = type;
81
//				}else if (type.equals("PushComment")){
82
//					MainApplication.h5_url = "111";
83
//					MainApplication.type = type;
84
//				}
85
86
87
            } catch (JSONException e) {
88
                e.printStackTrace();
89
            }
90
//			Log.e("articleUrl:", articleUrl);
91
            //打开自定义的Activity
92
            if ("PushRedBag".equals(type)) {
93
                long appTime4 = System.currentTimeMillis() / 1000;
94
                long updatetime4 = appTime4 - MainMapActivity.cha - 1;
95
                String token4 = String.valueOf(updatetime4);
96
                Intent intent4 = new Intent(context, MyWebViewActivity.class);
97
                String web1 = null;
98
                try {
99
                    web1 = MainApplication.url + "/zhannew/basic/web/index.php/discount/redlist?userid=" + MainApplication.userId + "&token=" + URLEncoder.encode(DES3.encode(token4));
100
                } catch (Exception e) {
101
                    e.printStackTrace();
102
                }
103
                intent4.putExtra("url", web1);
104
                context.startActivity(intent4);
105
                MobclickAgent.onEvent(context, "0808");
106
            } else {
107
                Intent i = new Intent(context, WelcomeActivity.class);
108
                i.putExtras(bundle);
109
                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
110
                context.startActivity(i);
111
            }
112
        } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
113
            Log.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
114
            //在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等..
115
116
        } else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
117
            boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
118
            Log.w(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected);
119
        } else {
120
            Log.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
121
        }
122
    }
123
124
    // 打印所有的 intent extra 数据
125
    private static String printBundle(Bundle bundle) {
126
        StringBuilder sb = new StringBuilder();
127
        if (bundle != null) {
128
            for (String key : bundle.keySet()) {
129
                if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
130
                    sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
131
                } else if (key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)) {
132
                    sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
133
                } else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
134
                    if (bundle.getString(JPushInterface.EXTRA_EXTRA).isEmpty()) {
135
                        Log.i(TAG, "This message has no Extra data");
136
                        continue;
137
                    }
138
139
                    try {
140
                        JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
141
                        Iterator<String> it = json.keys();
142
143
                        while (it.hasNext()) {
144
                            String myKey = it.next().toString();
145
                            sb.append("\nkey:" + key + ", value: [" +
146
                                    myKey + " - " + json.optString(myKey) + "]");
147
                        }
148
                    } catch (JSONException e) {
149
                        Log.e(TAG, "Get message extra JSON error!");
150
                    }
151
152
                } else {
153
                    sb.append("\nkey:" + key + ", value:" + bundle.getString(key));
154
                }
155
            }
156
        }
157
        return sb.toString();
158
    }
159
160
    //send msg to MainActivity
161
    private void processCustomMessage(Context context, Bundle bundle) {
162
        if (MainActicity.isForeground) {
163
            String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
164
            String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
165
            Intent msgIntent = new Intent(MainActicity.MESSAGE_RECEIVED_ACTION);
166
            msgIntent.putExtra(MainActicity.KEY_MESSAGE, message);
167
            if (!ExampleUtil.isEmpty(extras)) {
168
                try {
169
                    JSONObject extraJson = new JSONObject(extras);
170
                    if (null != extraJson && extraJson.length() > 0) {
171
                        msgIntent.putExtra(MainActicity.KEY_EXTRAS, extras);
172
                    }
173
                } catch (JSONException e) {
174
175
                }
176
177
            }
178
            context.sendBroadcast(msgIntent);
179
        }
180
    }
181
}

BIN
app/src/main/jniLibs/armeabi-v7a/libjcore234.so


BIN
app/src/main/jniLibs/armeabi/libjcore234.so


+ 1 - 1
app/src/main/res/layout/activity_car_owner_certificate.xml

@ -354,7 +354,7 @@
354 354
                android:layout_height="wrap_content"
355 355
                android:layout_marginTop="10dp"
356 356
                android:layout_marginBottom="30dp"
357
                android:text="认证说明\n\n1.车型信息和行驶证主页为必填项;\n2.最多可认证三款车型;\n3.默认首款认证车型为主车型;\n4.上传行驶证详细页面,并保证所有信息清晰;\n5.认证成功的首个车型可获得50元充电红包。"
357
                android:text="认证说明\n\n1.车型信息和行驶证主页为必填项;\n2.最多可认证三款车型;\n3.默认首款认证车型为主车型;\n4.上传行驶证详细页面,并保证所有信息清晰;\n5.认证成功的首个车型可获得50元充电优惠券。"
358 358
                android:textColor="#0D1120"
359 359
                android:textSize="14sp"
360 360
                app:layout_constraintBottom_toBottomOf="parent"

Sign In - Gogs: Go Git Service

Sign In