version:1.1
fix: add:应用使用数据统计
This commit is contained in:
78
app/src/main/java/com/uiui/sn/service/RemoteService.java
Normal file
78
app/src/main/java/com/uiui/sn/service/RemoteService.java
Normal file
@@ -0,0 +1,78 @@
|
||||
package com.uiui.sn.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.uiui.sn.IGetInfoInterface;
|
||||
import com.uiui.sn.utils.JGYUtils;
|
||||
import com.uiui.sn.utils.SPUtils;
|
||||
import com.uiui.sn.utils.Utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RemoteService extends Service {
|
||||
private String TAG = RemoteService.class.getSimpleName();
|
||||
|
||||
public RemoteService() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
Log.e(TAG, "onBind: ");
|
||||
return mBinde;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Log.e(TAG, "onCreate: ");
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e(TAG, "onStartCommand: ");
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
private IBinder mBinde = new IGetInfoInterface.Stub() {
|
||||
@Override
|
||||
public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserInfo() throws RemoteException {
|
||||
if (MainService.mPresenter != null) {
|
||||
MainService.mPresenter.getUserInfo();
|
||||
}
|
||||
String username = Settings.System.getString(getContentResolver(), "UserInfo_username");
|
||||
String avatar = Settings.System.getString(getContentResolver(), "UserInfo_avatar");
|
||||
// String gread = Settings.System.getString(getContentResolver(), "UserInfo_grade");
|
||||
int gread = (int) SPUtils.get(RemoteService.this, "int_grade", 0);
|
||||
String gankaoUID = Settings.System.getString(getContentResolver(), "gankaoUID");
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("username", username);
|
||||
jsonObject.addProperty("avatar", avatar);
|
||||
jsonObject.addProperty("grade", gread);
|
||||
jsonObject.addProperty("userid", gankaoUID);
|
||||
jsonObject.addProperty("sn", Utils.getSerial());
|
||||
Log.e(TAG, "getUserInfo:" + jsonObject.toString());
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHideAPP() throws RemoteException {
|
||||
return JGYUtils.getInstance().getHideList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getForbidAPP() throws RemoteException {
|
||||
return JGYUtils.getInstance().getForbidList();
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user