Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用gradle 建置專案時出現異常 #40

Open
daminemperor opened this issue Apr 27, 2020 · 11 comments
Open

使用gradle 建置專案時出現異常 #40

daminemperor opened this issue Apr 27, 2020 · 11 comments

Comments

@daminemperor
Copy link

https://github.com/GO-LiFE/GoFIT_SDK_Android

使用Android Studio 載入專案時會出現 lateinit property bundleFile has not been initialized
請問問題可能是?

@rik296
Copy link

rik296 commented Apr 28, 2020

Hi, 您好

您可以先試試看 issue #37 裡面提到的 gradle 設定看看是否能正常運行 🙏

@daminemperor
Copy link
Author

可以了,感謝
但在取得量測資料時,會出現下列訊息,message 都是空的,而且並沒進入onGetFitnessData,請問可能問題是?
4-28 13:25:13.209 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 461
04-28 13:25:13.281 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 471
04-28 13:25:13.435 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 481
04-28 13:25:13.510 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 491
04-28 13:25:13.581 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 501
04-28 13:25:13.731 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 511
04-28 13:25:13.809 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 521
04-28 13:25:13.881 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 531
04-28 13:25:14.035 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 541
04-28 13:25:14.106 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 551
04-28 13:25:14.185 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 561
04-28 13:25:14.333 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 571
04-28 13:25:14.405 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 581
04-28 13:25:14.487 14622-14622/com.goyourlife.gofit_demo I/demo_menu: doSyncFitnessData() : onProgress() : message = , progress = 591

@rik296
Copy link

rik296 commented Apr 28, 2020

Hi, 您好
這可能是您的手環長時間沒有配戴,建議您先使用 doInitialDevice() 或是 doClearDeviceData() 清除先前閒置時產生的資料,然後再配戴一段時間走路或是睡眠,再使用 doSyncFitnessData() 就會有資料產生了 🙏

@daminemperor
Copy link
Author

可以了,感謝

因為是要持續記錄心率資訊,所以是否有設定可以不讓手環進入休眠模式,感謝

@rik296
Copy link

rik296 commented Apr 28, 2020

手環是沒有休眠模式的,會時時在記錄資料,但您若是指手環的心率量測模式,因為要省電的關係,會在量測一段時間後關閉偵測燈,您若是要持續記錄,可以設定自動心率量測時間,最短可以設定一分鐘觸發一次,以下為 sample code,給您參考:

            // 設定手環自動量測心率的時間
            // 目前設定為 1 分鐘一次
            // 可在 careMeasureHR.setInterval((short) 1); 自行修改數值
            SetCareSetting mCareSettings = null;
            mCareSettings = _goFITSdk.getNewCareSettings();

            CareMeasureHR careMeasureHR = mCareSettings.getDefaultMeasureHR();
            careMeasureHR.setInterval((short) 1);
            mCareSettings.setMeasureHR(careMeasureHR);

            _goFITSdk.doSetSettings(mCareSettings, new GoFITSdk.SettingsCallback() {
                @Override
                public void onCompletion() {
                    Log.i(_tag, "doSetSettings() : onCompletion()");
                }

                @Override
                public void onProgress(String message) {
                    Log.i(_tag, "doSetSettings() : onProgress() : message = " + message);
                }

                @Override
                public void onFailure(int errorCode, String errorMsg) {
                    Log.e(_tag, "doSetSettings() : onFailure() : errorCode = " + errorCode + ", " + "errorMsg = " + errorMsg);
                }
            });

@daminemperor
Copy link
Author

您好,以提供之程式碼測試了一下
在 doConnectDevice 完成後新增 careMeasureHR.setInterval((short) 1) 的設定
並沒有發生異常

但 doSyncFitnessData 在 onCompletion 後 再等1分鐘, 並沒有再次執行 onGetFitnessData的動作

是我理解錯了嗎? 感謝

@rik296
Copy link

rik296 commented Apr 29, 2020

您可以觀察一下手環是否會固定一分鐘發出一次偵測燈號,來確定有沒有設定成功,doSyncFitnessData() 這個 function 是需要每分鐘的都呼叫一次,才能取得目前記錄在手環的最新資料

@daminemperor
Copy link
Author

daminemperor commented Apr 29, 2020

有使用handle 處理 每分鐘呼叫一次, 回傳資料的部份沒有問題了,
但當手環進入休眠模式時,回傳的資料都是舊的量測資料(偵測燈號沒有閃)
有設定了每分鐘執行時有設定careMeasureHR.setInterval((short) 1)
再次請教

@rik296
Copy link

rik296 commented Apr 29, 2020

是否方便提供程式碼給我們查看一下,或許可以看到哪邊有問題? 🙏

@daminemperor
Copy link
Author

daminemperor commented Apr 29, 2020

以下是執行的runabel

` private Runnable getPulse =new Runnable () {
public void run() {
Log.i(_tag,"每分鐘 執行 minutiute");
SetCareSetting mCareSettings = null;

        mCareSettings = _goFITSdk.getNewCareSettings();



        CareMeasureHR careMeasureHR = mCareSettings.getDefaultMeasureHR();

        careMeasureHR.setInterval((short) 1);

        mCareSettings.setMeasureHR(careMeasureHR);
        if (_goFITSdk != null) {
            Log.i(_tag, "demo_function_sync");

            // Demo - doSyncFitnessData API
            _goFITSdk.doSyncFitnessData(new GoFITSdk.SyncCallback() {
                @Override
                public void onCompletion() {
                    Log.i(_tag, "doSyncFitnessData() : onCompletion()");
                    showToast("Sync complete!\nDetail fitness data show in `Logcat`");
                }

                @Override
                public void onProgress(String message, int progress) {
                    Log.i(_tag, "doSyncFitnessData() : onProgress() : message = " + message + ", progress = " + progress);
                    Preference pPref = (Preference) findPreference("demo_function_sync");
                    String summary = String.format("%d", progress);
                    pPref.setSummary(summary);
                }

                @Override
                public void onFailure(int errorCode, String errorMsg) {
                    Log.e(_tag, "doSyncFitnessData() : onFailure() : errorCode = " + errorCode + ", " + "errorMsg = " + errorMsg);
                    showToast("doSyncFitnessData() : onFailure() : errorCode = " + errorCode + ", " + "errorMsg = " + errorMsg);
                }

                @Override
                public void onGetFitnessData(ArrayList<TableStepRecord> stepRecords, ArrayList<TableSleepRecord> sleepRecords, ArrayList<TablePulseRecord> hrRecords, ArrayList<TableSpO2Record> spo2Records) {
                    for (TableStepRecord step : stepRecords) {
                        Log.i(_tag, "doSyncFitnessData() : onGetFitnessData() : step = " + step.toJSONString());
                    }

                    for (TableSleepRecord sleep : sleepRecords) {
                        Log.i(_tag, "doSyncFitnessData() : onGetFitnessData() : sleep = " + sleep.toJSONString());
                    }

                    for (TablePulseRecord hr : hrRecords) {
                        Log.i(_tag, "doSyncFitnessData() : onGetFitnessData() : hr = " + hr.toJSONString());
                        //  Preference pPref = (Preference) findPreference("demo_function_sync");
                        Log.i(_tag,"getTime->" + hr.getTimestamp() + ";Pulse ->" + hr.getPulse());
                        //  pPref.setSummary("getTime->" + hr.getTimestamp() + ";Pulse ->" + hr.getPulse());
                    }

                    for (TableSpO2Record spo2 : spo2Records) {
                        Log.i(_tag, "doSyncFitnessData() : onGetFitnessData() : spo2 = " + spo2.toJSONString());
                    }
                }
            });
        }
        else {
            showToast("SDK Instance invalid, needs `SDK init`");
        }
        mThread.postDelayed(this, 60000);
    }
};`

@rik296
Copy link

rik296 commented Apr 29, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants