deercoder / fitbitapp Goto Github PK
View Code? Open in Web Editor NEWAndroid Fitbit-like App for fetching user information
Android Fitbit-like App for fetching user information
this is because the requested HTTP_URL has invalid values, in this example, it's "setting" instead of the correct "settings".
Another one is that I should the concatenated string using "+", not the ","
This is fixed by the getPermissionAsString() functions.
Use third-party libs, but face some issues when implementing in our fitbit apps:
null
at the endurl
above, I still cannot pass through the function, error is FileNotFound
when using urlConnectAnd the libs is a little behind the code, some codes are override, and some tasks are hidden but called, use debugging tools is good for tracking, but the solution still needs for researching. Something about the HTTP request...
See the note that I marked as the correct one, but still failed.
There is some issue when destroy the webview after log in, as we need to close this view, the error is shown as below:
Error: WebView.destroy() called while still attached!
This document serves as the guidance of the code, which will help us greatly understand the code well. I read the code, as well as using android studio debugging to track its process. Some process are hidden and it's not easy to track.
Just marking for future reference
Three basic modules:
when click login
MainFragment -> Fitbit.login -> EasySocialAuthActivity creating -> GetAccessToken
(parseToken etc...)
Token
EasyWebViewClient -> GetAccessToken ->
Fetch information
EasySocialFitbit -> GetUserInfo -> GetAccessToken -> "POST/GET packets"
When request some activity information like calorie, it seems that the callback function has null
parameter, which cause the code crashing, as follows:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.uwanttolearn.easysocialfacebooktesting, PID: 7690
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)
at org.json.JSONTokener.nextValue(JSONTokener.java:94)
at org.json.JSONObject.<init>(JSONObject.java:156)
at org.json.JSONObject.<init>(JSONObject.java:173)
at com.uml.deercoderi.fitbitmodule.EasySocialFitbit$1.requestComplete(EasySocialFitbit.java:100)
at com.uwanttolearn.easysocial.webrequests.GetWebRequest$LocalAsyncTask.onPostExecute(GetWebRequest.java:64)
at com.uwanttolearn.easysocial.webrequests.GetWebRequest$LocalAsyncTask.onPostExecute(GetWebRequest.java:42)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.access$500(AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5432)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:735)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
I/Process: Sending signal. PID: 7690 SIG: 9
The code snippets are located here:(but should be caused anywhere else)
public void getUserInfo(Context context, final UserInfoCallback userInfoCallback){
GetWebRequest getWebRequest = new GetWebRequest(new WebRequest.Callback() {
@Override
public void requestComplete(String line) {
try {
Log.e("EasySocialFitbit", "callback line " + line);
JSONObject jsonObject = new JSONObject(line);
userInfoCallback.onComplete(jsonObject);
} catch (JSONException e) {
e.printStackTrace();
userInfoCallback.onComplete(null);
}
}
});
getWebRequest.executeRequest(_EasySocialFitbitUrlManager.getUserInfoUrl(context));
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.