小编Aru*_*rut的帖子

蓝牙不将文件发送到其他设备

它已被问到,但我没有找到任何解决方案.对于蓝牙应用我正在使用bluetoothShare.class.

我的源代码,用于将文件发送到目标设备

MainActvity.class:

Set<BluetoothDevice> devices = btAdapter
                            .getBondedDevices();
                    final String btDeviceName = selected_deviceName;
                    BluetoothDevice device = null;

                    for (BluetoothDevice itDevice : devices) {
                        if (btDeviceName.equals(itDevice.getName())) {
                            device = itDevice;
                        }
                    }

                    if (device != null) {

                        ContentValues values = new ContentValues();
                        values.put(BluetoothShare.URI, uri.toString());
                        values.put(BluetoothShare.MIMETYPE, "image/jpeg");
                        values.put(BluetoothShare.DESTINATION,
                                device.getAddress());
                        values.put(BluetoothShare.DIRECTION,
                                BluetoothShare.DIRECTION_OUTBOUND);
                        Long ts = System.currentTimeMillis();
                        values.put(BluetoothShare.TIMESTAMP, ts);
                        final Uri contentUri = getApplicationContext()
                                .getContentResolver().insert(
                                        BluetoothShare.CONTENT_URI, values);
                        Log.v(TAG, "Insert contentUri: " + contentUri
                                + "  to device: " + device.getName());
                        Toast.makeText(getApplicationContext(), "Success", …
Run Code Online (Sandbox Code Playgroud)

android android-bluetooth

9
推荐指数
1
解决办法
2689
查看次数

window.location.hash始终显示为空

在我的phonegap应用程序中,我更新了我的数据,我有以下代码,因为我得到window.location.hash(*表示错误行)值将为空.

function init() {

    $("#homePage").live("pageshow", function() {
    getDatas();
});

$("#editPage").live("pageshow", function() {
    ***var loc = window.location.hash;***
    alert("loc" + loc);
    if(loc.indexOf("?") >= 0) {
        var qs = loc.substr(loc.indexOf("?")+1, loc.length);
        var detailId = qs.split("=")[1];
        $("#editFormSubmitButton").attr("disabled", "disabled");
        dbShell.transaction(function(tx) {
            tx.executeSql("select id,name,age,city,occupation from nameDetail where id=?", [detailId], function(tx, results) {
                $("#mId").val(results.rows.item(0).id);
                $("#mName").val(results.rows.item(0).name);
                $("#mAge").val(results.rows.item(0).age);
                $("#mCity").val(results.rows.item(0).city);
                $("#mOccupation").val(results.rows.item(0).occupation);
                $("#editFormSubmitButton").removeAttr("disabled");
            });
        }, dbErrHandler);
    } else {
    alert("empty");
        $("#editFormSubmitButton").removeAttr("disabled");
    }
});

}

function getDatas() {
dbShell.transaction(function(tx) {
    tx.executeSql("select id,name,age,city,occupation,date from nameDetail order by date desc", [], renderEntries, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery cordova

7
推荐指数
1
解决办法
4426
查看次数

标签 统计

android ×1

android-bluetooth ×1

cordova ×1

javascript ×1

jquery ×1