CenterService.java
4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package com.hjx.personalcenter.service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import com.google.gson.Gson;
import com.hjx.personalcenter.activity.LoginAndRegisterActivity;
import com.hjx.personalcenter.db.SaveParam;
import com.hjx.personalcenter.model.CardInfo;
import com.hjx.personalcenter.model.LoginInfo;
import com.hjx.personalcenter.util.GetDevicesUtil;
/**
* Created by h on 2017/9/1.
*/
public class CenterService extends BaseService {
enum ACTIVITY_ACTION{
userinfo_activity
}
public CenterService(){
}
IPresonalInterface.Stub binder = new IPresonalInterface.Stub() {
@Override
public String sayHello() throws RemoteException {
return "这是测试AIDL的方法";
}
@Override
public String viewPage(String action) throws RemoteException {
String result = null;
if(action.equals(ACTIVITY_ACTION.userinfo_activity.toString())){
//登录界面
Intent intent = new Intent();
intent.setClass(CenterService.this, LoginAndRegisterActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
result= "跳转成功";
}
return result;
}
@Override
public String getSimpleUser() throws RemoteException {
String logininfo = null;
Gson gson = new Gson();
LoginInfo loginInfo = new LoginInfo();
String islogin = SaveParam.getInstance().getLoginParam(getApplication(),"login");
if ("true".equals(islogin)){
loginInfo.setUsername(SaveParam.getInstance().getLoginParam(getApplication(), "username"));
loginInfo.setPassword(SaveParam.getInstance().getLoginParam(getApplication(), "password"));
loginInfo.setAccess_token(SaveParam.getInstance().getLoginParam(getApplication(), "access_token"));
loginInfo.setLoginStatus(SaveParam.getInstance().getLoginParam(getApplication(), "login"));
loginInfo.setUserId(SaveParam.getInstance().getLoginParam(getApplication(), "userId"));
logininfo =gson.toJson(loginInfo);
Log.e("test","登录信息"+logininfo);
}
return logininfo;
}
//保卡信息
@Override
public String getcardUser() throws RemoteException {
String results = null;
// CardInfo cardInfo = new CardInfo();
CardInfo.DataBean dataBean = new CardInfo.DataBean();
Gson gson = new Gson();
//获取设备信息
dataBean.setProductModel(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceModel());
dataBean.setDeviceNumber(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceNumber());
dataBean.setMacAddress(GetDevicesUtil.getDevicesInfo(getApplication()).getMac());
//获取保卡信息
dataBean.setCustomerName(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CUNSTEMNAME));
dataBean.setCustomerAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ADRESSCUNSTEM));
dataBean.setBuyTime(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTIME));
dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS));
dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE));
dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE));
// cardInfo.setData(dataBean);
results =gson.toJson(dataBean);
Log.e("test","保卡信息"+results);
return results;
}
@Override
public String getUserInfo() throws RemoteException {
return null;
}
@Override
public String logout() throws RemoteException {
return null;
}
@Override
public String validateToken() throws RemoteException {
return null;
}
@Override
public String getDeviceID() throws RemoteException {
return null;
}
@Override
public String getChildsInfo() throws RemoteException {
return null;
}
};
@Override
public IBinder onBind(Intent intent) {
return binder;
}
}