Android Application for Sending a File using Bluetooth OBEX Object Push Profile (OPP)
I tried the following application example for sending a file over Bluetooth OPP in Android Froyo.
Please sugest any solution for this, thanks in advance.
My Application Code:
public class BtAppExample extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String filePath = Environment.getExternalStorageDirectory().toString() + "/Munnar/1.jpg";
Log.e("BtAppExample","Uri is: "+Uri.fromFile(new File(filePath)).toString());
ContentValues values = new ContentValues();
values.put(BluetoothShare.URI,Uri.fromFile(new File(filePath)).toString());
values.put(BluetoothShare.DESTINATION, "90:4C:E5:D9:0E:D0");
values.put(BluetoothShare.DIRECTION, BluetoothShare.DIRECTION_OUTBOUND);
Long ts = System.currentTimeMillis();
values.put(BluetoothShare.TIMESTAMP, ts);
Uri contentUri = getContentResolver().insert(BluetoothShare.CONTENT_URI, values);
}
}
My Manifest file:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".BtAppExample"
android:label="@string/app_name">
<开发者_如何学编程intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
精彩评论