خرید بک لینک

Vote count: 0

Hye, i have problems with my android apps. This apps is to scan data from beacons and eddystone and the data will be save to local file and also a server. Im using volley string request method to fetch the data and not sure so much is it correct or not.The apk was build successfully but my server didn't receive the data. Its just blank. Much thanks if you guys can help me.

This is my mainactivity.java part to sent the data.

private void stopScaing(Button scanButton) {

    try {
        beaconManager.stopRangingBeaconsInRegion(region);
    } catch (RemoteException e) {
            // TODO - OK, what now then?
    }
    String scanData = logString.toString();
    if (scanData.length() > 0)
    {
        String url = "http://beaconscaer.byethost33.com/insertbeacondata.php";

        StringRequest postRequest = new StringRequest(Request.Method.POST, url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {

                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {

                    }
                }
        ) {
            @Override
            protected Map<String, String> getParams()
            {
                Map<String,String> params = new HashMap<String, String>();
                // the POST parameters:

                params.put("scanInterval",PREFERENCE_SCANINTERVAL);
                params.put("timestamp",PREFERENCE_SCANINTERVAL);
                params.put("power",PREFERENCE_POWER);
                params.put("proximity",PREFERENCE_PROXIMITY);
                params.put("rssi",PREFERENCE_RSSI);
                params.put("majorMinor",PREFERENCE_MAJORMINOR);
                params.put("uuid",PREFERENCE_UUID);
                params.put("index",PREFERENCE_INDEX);
                params.put("location",PREFERENCE_LOCATION);
                params.put("realTimelog",PREFERENCE_REALTIME);
                retu params;
            }
        };
        Volley.newRequestQueue(this).add(postRequest);
// Write file
        fileHelper.createFile(scanData);
        // Display file created message.
        Toast.makeText(getBaseContext(),
                "File saved to:" + getFilesDir().getAbsolutePath(),
                Toast.LENGTH_SHORT).show();
        scanButton.setText(MODE_STOPPED);

    } else {
        // We didn't get any data, so there's no point writing an empty file.
        Toast.makeText(getBaseContext(),
                "No data captured during scan, output file will not be created.",
                Toast.LENGTH_SHORT).show();
        scanButton.setText(MODE_STOPPED);
    }
}

And this is the php coding:

enter image description here

asked 7 mins ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 19 فروردين 1395 ساعت: 16:32

صفحه بندی