I'm setting up a simple demo of SUP on android natively but I'm having a few doubts regarding how to use personalization keys.
Using the SUP101 sample as a basis (here), I've created a 'state_pk' personalization key to filter customers by state. I'd like to be able to get this data by using the "search button" from Android (which I already have setup and showing correctly).
I've also added a findByState object query to the customer MBO to be able to filter, but to my (little) understanding the correct way is to use the personalization key to filter data.
Given this, can anyone point me on how to use the Personalization Key 'state_pk'?
I've already generated the code, added it to the Android app but I don't know/can't seem to find how I am going to use the PersonalizationParameter to fetch the data and update the customer ListView on the main activity (where the customer list is displayed).
Can anyone help?
I'm using SUP 2.1.3 and Android API 15 (4.0.3).
Using Personalization Keys are simple:
PersonalizationParameters pk = (Your DB Class).getPersonalizationParameters();
pk.setXXXX("set Value Here!!!");
pk.save();
Once you set the Personalization keys, you can now call your DB classes Sync method using:
DB.synchronize("your Sync group name goes here!!!");
Once this is done, you can call your FindAlL Object Query to retrieve a List of Customers to Display
Personalization keys are used to filter the data flowing from the backend to your SUP server. So you have to set personalization keys before you syncronize, syncronize will refresh the data in the server followed by data refresh on the device
There are few cases you need to consider.
1) Which cache policy you are implementing to your application,
2) Do you need cache partitioning based on user.
If you are using Ondemand policy you need to enable the partition data based on user check box in the cache policy properties. So now every personalization key mapped to a load parameter will have a partion created in cache databse,(Be carefull while selecting a personalization key)
In case of Scheduled cache policy you cannot use personalization key, insted you can use syncronization parameters and map it with the load parameters to cause partioning,
In case of DCN cache policy there will not be any partionions in the cache database and you have to use object queries to filter data,