我刚开始使用卵石,我下载了他们的海洋调查演示程序:https://github.com/pebble/pebble-sdk-examples/tree/master/data-logging-demo/OceanSurveyDemo-Android
但是当我在cloudpebble上运行它和演示时,我看到的只是我的Android应用程序上的黑屏。我想知道是否还有其他任何我想让数据记录在这里正常工作?我还尝试了其他一些示例,如下所示:http://developer.getpebble.com/guides/mobile-apps/android/android-datalogging/
我从cloudpebble上的日志记录会话中返回DATA_LOGGING_SUCCESS但是当我使用他们提供的接收代码时,我的手机上没有显示任何内容:
package com.getpebble.dataloggingtest;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;
import com.getpebble.android.kit.PebbleKit;
import com.getpebble.android.kit.PebbleKit.PebbleDataLogReceiver;
import java.util.UUID;
/**
* MainActivity class
* Implements a PebbleDataLogReceiver to process received log data,
* as well as a finished session.
*/
public class MainActivity extends Activity {
// Configuration
private static final UUID WATCHAPP_UUID = UUID.fromString("12258306-6cff-4b67-8af3-6f14105e8d8f");
private static final int DATA_LOG_TAG_COMPASS = 52;
// App elements
private PebbleDataLogReceiver dataloggingReceiver;
private TextView textView;
private StringBuilder resultBuilder = new StringBuilder();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Setup TextView
textView = (TextView)findViewById(R.id.text_view);
textView.setText("Waiting for logging data...");
}
@Override
protected void onResume() {
super.onResume();
// Define data reception behavior
PebbleDataLogReceiver dataloggingReceiver = new PebbleDataLogReceiver(WATCHAPP_UUID) {
@Override
public void receiveData(Context context, UUID logUuid, Long timestamp, Long tag, int data) {
// Check this is the compass headings log
if(tag.intValue() == DATA_LOG_TAG_COMPASS) {
// Get the compass value and append to result StringBuilder
resultBuilder.append("Heading: " + data + " degrees");
resultBuilder.append("\n");
}
}
@Override
public void onFinishSession(Context context, UUID logUuid, Long timestamp, Long tag) {
super.onFinishSession(context, logUuid, timestamp, tag);
// Display all compass headings received
textView.setText("Session finished!\n" + "Results were: \n\n" + resultBuilder.toString());
}
};
// Register DataLogging Receiver
PebbleKit.registerDataLogReceiver(this, dataloggingReceiver);
}
@Override
protected void onPause() {
super.onPause();
// Always unregister callbacks
if(dataloggingReceiver != null) {
unregisterReceiver(dataloggingReceiver);
}
}
}
我一定是在误解某些东西,但为什么我的手机没有得到任何数据?我在Android Studio中没有看到任何错误。
答案 0 :(得分:0)
我认为您没有获得任何数据,因为您需要按下手表上的按钮才能开始向手表发送数据。