The Homescreen API lets you put small widgets on the home screen of the Nokia N97. I'm not sure if any other phone supports the API or if any other phone ever will, but for a project we created a Python 2.0 extension that lets you create such a widget from Python.
The SIS file can be found here, the sources can be found here.
Friday, July 30, 2010
Android Bluetooth scanning
Discovering Bluetooth devices in Android is fairly simple, there are a lot of examples on the internet. What not all of those examples show you, and what got me into trouble was the bold bit in the code snippet below: I didn't realise that BluetoothAdapter.getDefaultAdapter() will return null when the user turns Bluetooth of in the phone settings. That got me a nice NullPointerException ...
}
}
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (bluetoothAdapter == null) {
// bluetooth disabled/not available
}
else {
context.registerReceiver(new BluetoothListener(), new IntentFilter(BluetoothDevice.ACTION_FOUND));
if (bluetoothAdapter == null) {
// bluetooth disabled/not available
}
else {
context.registerReceiver(new BluetoothListener(), new IntentFilter(BluetoothDevice.ACTION_FOUND));
bluetoothAdapter.startDiscovery();
}
}
private class BluetoothListener extends BroadcastReceiver {
@Override
public void onReceive(Context c, Intent intent) {
BluetoothDevice rbd = (BluetoothDevice)intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
// ...@Override
public void onReceive(Context c, Intent intent) {
BluetoothDevice rbd = (BluetoothDevice)intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
}
}
Download an Android apk file from your site
This will probably never happen to you but, if you're in a similar situation as me, which is:
- you've got a website
- the website uses HTTPS and a self-signed certificate
- you try to download an APK file from that website directly onto your phone
Install Android USB Driver for Windows to connect to a HTC Wildfire
I tried to install the Android USB Driver for Windows whilst my HTC Wildfire was connected to my PC. This failed. After some head-scratching and searching, I found out that I had to change the android_winusb.inf file (which is part of the installation files) so that it would recognize the device:
[Google.NTx86]The bold lines are the ones I added: VID_0BB4 means Vendor ID = HTC, PID_0C8B means Product ID = Wildfire.
; HTC Dream
%SingleAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C01
%CompositeAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C02&MI_01
%SingleBootLoaderInterface% = USB_Install, USB\VID_0BB4&PID_0FFF
; HTC Magic
%CompositeAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C03&MI_01
; HTC Wildfire
%SingleAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C8B
%CompositeAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C8B&MI_01
%SingleBootLoaderInterface% = USB_Install, USB\VID_0BB4&PID_0C8B
Subscribe to:
Posts (Atom)