cubeacon / android-cubeacon-sample

Android Cubeacon Sample Project
12 stars 10 forks source link

Cubeacon Callback Error on Lollipop #14

Open friski opened 8 years ago

friski commented 8 years ago

06-19 15:01:32.517 12281-12370/tel_u.kc.pkm.markingbabe E/CubeaconSDK: com.eyro.cubeacon.ParseCloudBuilder.execute:177 Error request : java.io.FileNotFoundException: https://api.parse.com/1/classes/cbv7y3Up1H 06-19 15:01:32.657 12281-12368/tel_u.kc.pkm.markingbabe E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2 Process: tel_u.kc.pkm.markingbabe, PID: 12281 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator org.json.JSONObject.keys()' on a null object reference at com.eyro.cubeacon.RequestBuilder.execute(RequestBuilder.java:108) at com.eyro.cubeacon.CBLogAnalyticKii.setACLtoBucket(CBLogAnalyticKii.java:166) at com.eyro.cubeacon.CBLogAnalyticKii.requestAdminAccess(CBLogAnalyticKii.java:144) at com.eyro.cubeacon.CBLogAnalyticKii.doInBackground(CBLogAnalyticKii.java:80) at com.eyro.cubeacon.CBLogAnalyticKii.doInBackground(CBLogAnalyticKii.java:31) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:818) 

friski commented 8 years ago

i got this error on android 5 lollipop, but works fine on android version below, such as kitkat.

this is the code in MainActivity extend CBAppAcctivity, (onCreate)

CBApp.getInstance().setBeaconListener(this, new BeaconListener() { @Override public void onImmediateBeacon(CBBeacon cbBeacon) { }

            @Override
            public void onNearBeacon(CBBeacon cbBeacon) {
            }

            @Override
            public void onFarBeacon(CBBeacon cbBeacon) {
            }

            @Override
            public void onEnterBeacon(CBBeacon cbBeacon) {
                String idbeacon = cbBeacon.getBeaconID().toString();
                int idmajor = cbBeacon.getMajor();
                String idminor = cbBeacon.getName();
                Log.e("tag", idbeacon);
                Log.e("tag", String.valueOf(idmajor));
                Log.e("tag", idminor);
                //Log.d("Handlers", "Called on main thread");

                AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this);
                alertDialogBuilder.setCancelable(false)
                        .setTitle("MarkingBabe Say :")
                        .setMessage("You're entering MarkingBabe area, continue?");

                alertDialogBuilder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface arg0, int arg1) {
                        Intent intent = new Intent(MainActivity.this, UserReservationActivity.class);
                        startActivity(intent);
                        finish();
                    }
                });

                alertDialogBuilder.setNegativeButton("No",new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });

                AlertDialog alertDialog = alertDialogBuilder.create();
                alertDialog.show();
            }

            @Override
            public void onExitBeacon(CBBeacon cbBeacon, long interval) {
            }

            @Override
            public void onNearestBeaconChanged(CBBeacon cbBeacon, CBBeacon cbBeacon1) {
            }

            @Override
            public void onEmptyBeacon() {
            }
        });
        CBApp.getInstance().setScanPeriod(ScanningMode.VERY_HIGH);
        CBApp.getInstance().createService();
        CBApp.getInstance().startService();
alann-maulana commented 8 years ago

Hi @friski,

Thanks for reporting, we will fix this on next release.

Regards.