Giter Site home page Giter Site logo

fitbitapp's People

Contributors

deercoder avatar

Watchers

 avatar  avatar

fitbitapp's Issues

Invalid scope when login

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.

FileNotFound: when access token using the formated url

Use third-party libs, but face some issues when implementing in our fitbit apps:

  • GetAccessToken::doInbackground(), this functioin's param[0] is url, but it appends an null at the end
  • Even I use correct url above, I still cannot pass through the function, error is FileNotFound when using urlConnect

And 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.

Webview issue when destroying

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!

Some guidance about the code

NOTE

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

Overview

Three basic modules:

  • EasySocial: basic module, some POST/GET operation related with facebook(NEED enhancement)
  • EasySocialFacebook: facebook implementation(third-party example)
  • MyFitBitModule: our implementation, bug fixs, adjusted version for fitbit.
  • App: Entry for the main activity/application

Process

when click login
MainFragment -> Fitbit.login -> EasySocialAuthActivity creating -> GetAccessToken
(parseToken etc...)

Token
EasyWebViewClient -> GetAccessToken ->

Fetch information
EasySocialFitbit -> GetUserInfo -> GetAccessToken -> "POST/GET packets"

NullPointerException: When request the activity information using Json Libs

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));
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.