publicclassMyAppContextextendsMultiDexApplication {
publicvoidonCreate() {
super.onCreate();
TBuildertBuilder = newTBuilder(this, "CLIENT_ID", "CLIENT_SECRET", "IDENTIFIER", "UUID");
// intent that opened when notification pressedIntentintent = newIntent(getApplicationContext(), NotificationActivity.class);
tBuilder.setIntent(intent);
// set notification icontBuilder.setSmallIcon(R.drawable.ic_launcher);
// change notify period between different beacons notification in millisecond// DEFAULT: 10 * 60 * 1000 (10 minutes)tBuilder.setDifferentBeaconNotifyPeriod(1000);
// change notify period between same beacons notification in millisecond// DEFAULT: 30 * 60 * 1000 (30 minutes)tBuilder.setSameBeaconNotifyPeriod(20000);
Callback.OnLoggedEventRecordListenerloggedEventRecordListener = newCallback.OnLoggedEventRecordListener() {
@OverridepublicvoidonEventLoggedRecord(HashMaphashMap) {
System.out.print(hashMap);
}
};
tBuilder.setEventLoggerListener(loggedEventRecordListener);
// to receive feature_id if the action of ad is navigate to map location// you should open the map and navigate to the location that recivedCallback.OnMapButtonPressedListeneronMapButtonPressedListener = newCallback.OnMapButtonPressedListener() {
@OverridepublicvoidonMapButtonPressed(HashMaphashMap) {
System.out.print(hashMap);
// dispatch to tagipedia maps to navigate to location should be like this// LinkedHashMap<String, Object> navigationParams = new LinkedHashMap<String, Object>();// navigationParams.put("route_to", (String)hashMap("feature_id"));// new HashMap<String, Object>(){{// put("type", "SHOW_NAVIGATION_DIALOG");// put("navigation_params", navigationParams);// }}
}
};
tBuilder.setMapButtonPressedListener(onMapButtonPressedListener);
//to receive when user enter beacon regionCallback.OnEnterBeaconRegionListeneronEnterBeaconRegion = newCallback.OnEnterBeaconRegionListener(){
@OverridepublicvoidonEnterBeaconRegion(HashMapdata) {
System.out.print(data);
//enter_date the date that the user enter the area which beacon cover it return in millisecond since 1970//data contain enter_date and others data belong to beacon
}
};
tBuilder.setEnterBeaconRegionListener(onEnterBeaconRegion);
//to receive when user exit beacon regionCallback.OnExitBeaconRegionListeneronExitBeaconRegion = newCallback.OnExitBeaconRegionListener(){
@OverridepublicvoidonExitBeaconRegion(HashMapdata) {
System.out.print(data);
//time_spent the time that the user spent in the area which beacon cover it return in milliseconds//enter_date and exit_date the date that the user enter and exit the area which beacon cover it return in millisecond since 1970//data contain enter_date, exit_date, time_spent and others data belong to beacon
}
};
tBuilder.setExitBeaconRegionListener(onExitBeaconRegion);
//to monitoring specific regionstBuilder.setRegions(newArrayList<TRegion>(Arrays.asList(newTRegion(UUID, major, minor), ...)));
tBuilder.build();
//to register user with interests//this will show ads based on matching between ad interests and user interests otherwise it will show ads that was created without interests//String[] interestsTBuilder.identifyUser("USER_NAME", interests);
}
}
publicclassNotificationActivityextendsAppCompatActivity {
@OverrideprotectedvoidonCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notification);
Bundlebundle = getIntent().getExtras();
HashMaptopic = (HashMap) bundle.getSerializable("topic");
System.out.println("Topic " + topic);
// you can show ad with its assigned templateTUtils.showAdDialog(this,topic);
// you can use topic getters to display it in view
}
}
Hint: to ask user to enable bluetooth we have method for it.
TUtils.showBluetoothDialog(this, "Open bluetooth" , "we use bluetooth for .... please open it");
Hint: to ask user to enable location for android bigger than or equal 23 we have method for it.
TUtils.showLocationDialog(this, "Open Location" , "we use location for .... please open it");
Hint: to show ad with its assigned template.
TUtils.showAdDialog(this,topic);
Hint: to logout user..
TBuilder.logoutUser();
Hint: to receive current region user located at. you should set the regions (ArrayList of TRegion ) before build