cubeacon / android-cubeacon-sample

Android Cubeacon Sample Project
12 stars 10 forks source link

protected void #6

Closed andra17 closed 9 years ago

andra17 commented 9 years ago

I want to make my custom activity when my device enter beacon area,here is my code :

protected void onEnteredBeacon(CBBeacon beacon){ Intent i=new intent(mainactivity.this,register.class); startActivity (i); super.onEnteredBeacon(beacon);}

But when i run it on my device the register activity couldnt show up, why is this happening and how to solve it? Regards

alann-maulana commented 9 years ago

Hi @andra17

First, check if your storyline are enabled on Cubeacon Developer. If you want to disabled the default storyline campaign, you can uncheck all the schedule days from storyline. So it will just call the callback event on the SDK.

Regards.

andra17 commented 9 years ago

Already done,but still not working It works perfectly when i only call layout

protected void onEnteredBeacon(CBBeacon beacon){ setContentView(R.layout.activity);}

But when im trying to call other class (explained bfore) its not working...any other idea? :)

Regards

alann-maulana commented 9 years ago

Hi @andra17

We are already trying to reproduce your code into our Android Cubeacon Sample. You can pull to update from this repository. Here is some code we reproduce :

    @Override
    protected void onEnteredBeacon(CBBeacon beacon) {
        // TODO Auto-generated method stub
        String message = beacon.getName() + " entered, major: " + beacon.getMajor() + ", minor: " + beacon.getMinor();
        Log.i(tag, message);
        Intent intent = new Intent(this, BeaconActivity.class);
        intent.putExtra(MainActivity.EXTRA_INTENT, message);
        startActivity(intent);
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_beacon);
        getActionBar().setDisplayHomeAsUpEnabled(true);

        Bundle bundle = getIntent().getExtras();
        String message = bundle.getString(MainActivity.EXTRA_INTENT);
        Toast.makeText(this, message, Toast.LENGTH_LONG).show();

        // .......
    }

It's running well. You can try it.

Regards.

andra17 commented 9 years ago

working perfectly :) thanks a lot

alann-maulana commented 9 years ago

You're welcome @andra17 . If you need another questions, please open a new issue.

Thanks and regards.

andra17 commented 9 years ago

and how to send my beacon id information to my server? (im using my sql)