Added code to stop watch app before starting it to try to improve reliability of app start.

This commit is contained in:
Graham Jones
2016-07-19 22:25:06 +01:00
parent 51c277f691
commit d44ec7c489
4 changed files with 17 additions and 7 deletions

View File

@@ -401,9 +401,18 @@ public class SdDataSourcePebble extends SdDataSource {
* Attempt to start the pebble_sd watch app on the pebble watch.
*/
public void startWatchApp() {
Log.v(TAG, "startWatchApp()");
PebbleKit.startAppOnPebble(mContext, SD_UUID);
Log.v(TAG, "startWatchApp() - closing app first");
// first close the watch app if it is running.
PebbleKit.closeAppOnPebble(mContext, SD_UUID);
// then start it after a 1 second delay.
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Log.v(TAG, "startWatchApp() - starting watch app...");
PebbleKit.startAppOnPebble(mContext, SD_UUID);
}
}, 1000);
}
/**