cubeacon / android-cubeacon-sample

Android Cubeacon Sample Project
12 stars 10 forks source link

disable campaign pop up #2

Closed djguiaume closed 9 years ago

djguiaume commented 9 years ago

Hello, I cannot figure how to keep the storyline infomation associated with the beacon but not having the pop up of the campaign displayed.

I am on android. My config is like this:

"CB_SHOW_BG_ALERT" = false "CB_SHOW_FG_ALERT" =false "CB_SHOW_ALERT_ON_ENTER"=false "CB_SHOW_ALERT_ON_EXIT"=false "APPLY_STORYLINE"=true

Best regards.

alann-maulana commented 9 years ago

Hi @djguiaume, Thanks for your response. According to your issue, you can follow this steps :

CB_SHOW_BG_ALERT=false
CB_SHOW_FG_ALERT=false
CB_SHOW_ALERT_ON_ENTER=false
CB_SHOW_ALERT_ON_EXIT=false
APPLY_STORYLINE=true
  [ ] All    [ ] Sun    [ ] Mon    [ ] Tue    [v] Wed    [ ] Thu    [ ] Fri    [ ] Sat

or you can select all :

  [v] All    [v] Sun    [v] Mon    [v] Tue    [v] Wed    [v] Thu    [v] Fri    [v] Sat 

Best Regards.

djguiaume commented 9 years ago

hi,

Actually I don't use the cubeacon.properties file. I use this method :

    setup(Context context, java.lang.String cubeaconID, java.lang.String cubeaconKey, Java.lang.String kiiAppID, java.lang.String kiiAppKey, java.lang.String kiiSite, boolean ApplyStoryline, boolean CBShowBGAlert, boolean CBShowFGAlert, boolean CBShowAlertOnEnter, boolean CBShowAlertOnExit, java.lang.String CBDefaultAlertTitle, java.lang.String CBDefaultAlertMsg)

Like this

    CBApp.setup(this, getString(R.string.CB_ID),
        getString(R.string.CB_KEY),
        getString(R.string.KII_APP_ID),
        getString(R.string.KII_APP_KEY),
        getString(R.string.KII_SITE),
        getResources().getBoolean(R.bool.APPLY_STORYLINE),
        getResources().getBoolean(R.bool.CB_SHOW_BG_ALERT),
        getResources().getBoolean(R.bool.CB_SHOW_FG_ALERT),
        getResources().getBoolean(R.bool.CB_SHOW_ALERT_ON_ENTER),
        getResources().getBoolean(R.bool.CB_SHOW_ALERT_ON_EXIT),
        getString(R.string.CB_DEFAULT_ALERT_TITLE),
        getString(R.string.CB_DEFAULT_ALERT_MSG));

    <resources>

        <string name="CB_ID">...</string>
        <string name="CB_KEY">...</string>
        <string name="KII_APP_ID">...</string>
        <string name="KII_APP_KEY">...</string>
        <string name="KII_SITE">US</string>
        <bool name="CB_SHOW_BG_ALERT">false</bool>
        <bool name="CB_SHOW_FG_ALERT">false</bool>
        <bool name="CB_SHOW_ALERT_ON_ENTER">false</bool>
        <bool name="CB_SHOW_ALERT_ON_EXIT">false</bool>
        <string name="CB_DEFAULT_ALERT_TITLE">Found Beacon</string>
        <string name="CB_DEFAULT_ALERT_MSG">You have #event for : #beacon_name</string>
        <bool name="APPLY_STORYLINE">true</bool>

    </resources>

And I selected all in the schedule.

Best regards

alann-maulana commented 9 years ago

Hi @djguiaume,

Sorry for the inconvenience, please use this setup method in your application class :

public class DemoApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        // add this line first before the setup method with 12 parameters
        CBApp.setup(this);

        // then you can add your setup with 12 parameters below this line or in your startup activity
        // TODO: setup(Context context, java.lang.String cubeaconID, java.lang.String cubeaconKey, Java.lang.String kiiAppID, java.lang.String kiiAppKey, java.lang.String kiiSite, boolean ApplyStoryline, boolean CBShowBGAlert, boolean CBShowFGAlert, boolean CBShowAlertOnEnter, boolean CBShowAlertOnExit, java.lang.String CBDefaultAlertTitle, java.lang.String CBDefaultAlertMsg)

    }
}

Best Regards

djguiaume commented 9 years ago

hi @alann-maulana,

Thanks for the answer. As you advised I implemented my class app like this :

public class LaBeaconApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        CBApp.setup(this);
        CBApp.setup(this, getString(R.string.CB_ID),
                getString(R.string.CB_KEY),
                getString(R.string.KII_APP_ID),
                getString(R.string.KII_APP_KEY),
                getString(R.string.KII_SITE),
                true,
                false,
                false,
                false,
                false,
                "Found Beacon",
                "You have #event for : #beacon_name");
    }
}

And I still get the pop up

screenshot_2015-06-03-16-42-15

After this method :

@Override
    protected void onFarBeacon(CBBeacon beacon) {
        super.onFarBeacon(beacon);
        Log.d("labeacon", beacon.toString());
    }

And if I set ApplyStoryline param to false I don't have the popup anymore but i don't have access to the storyline data in CBBeacon either.

Best Regards,

P.S. thanks for your time

alann-maulana commented 9 years ago

Hi @djguiaume,

My bad for missreading your first question :

I cannot figure how to keep the storyline infomation associated with the beacon but not having the pop up of the campaign displayed.

So if you want to keep the storyline data downloaded, you must set up APPLY_STORYLINE=true and to avoid auto pop up storyline campaign you can just disabled all the schedule days of your storyline. After this set up, we will :

  1. Get storyline data downloaded
  2. Didn't show auto pop up for storyline campaign for all days
  3. Still get the callback from the beacon event like onEnterBeacon, onExitBeacon, onImmediateBeacon, onNearBeacon and onFarBeacon.

Best Regards,

djguiaume commented 9 years ago

Hello @alann-maulana ,

Just tried it. Works perfectly. Thanks a lot.

Best regards,