在 Package Explorer 裡的點選 AndroidManifest.xml
並在 Exporting 裡找 Export an unsiged APK and sign it manually
<manifest …> …………… …………… <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH" /> …………… …………… </manifest>
import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.content.Intent; import android.os.Bundle; public class Android_Bluetooth extends Activity { private static final int REQUEST_ENABLE_BT = 0; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapter != null) { if (!mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT); } } else{ tv1.setText("not bluetooth sensor"); } } }
String res="";
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
// If there are paired devices
if (pairedDevices.size() > 0) {
// Loop through paired devices
for (BluetoothDevice device : pairedDevices) {
// Add the name and address to an array adapter to show in a ListView
res += device.getName() + " " + device.getAddress() +"\n";
}
}
application: hello version: 1 runtime: python api_version: 1 handlers: - url: / script: main.py
print 'Content-Type: text/plain' print '' print 'Hello, world'
INFO 2010-07-15 20:26:11,663 appengine_rpc.py:159] Server: appengine.google.com INFO 2010-07-15 20:26:11,671 appcfg.py:357] Checking for updates to the SDK. INFO 2010-07-15 20:26:15,536 appcfg.py:366] Update check failed: <urlopen error The read operation timed out> INFO 2010-07-15 20:26:15,661 dev_appserver_main.py:431] Running application hello on port 8080: http://localhost:8080