Get poll (full)
// ...
Polljoy.getPoll(appVersion,
level,
session,
timeSinceInstall,
userType,
tags,
delegate);
// ...
In summary:
appVersion
(optional) Set to null if you prefer not to send it. Or you can choose to pass it. eg 1.0.35
level
(optional) Set as 0 if you prefer not to send it. If your app has levels you can pass them here. eg 34
session
(optional) Set it as "Polljoy.Session" and the SDK will count it for you. Or you can manually send it. eg 3
timeSinceInstall
(optional) Set it as "PolljoyCore.getTimeSinceInstall()" and the SDK will count it for you. Or you can manually set it by sending a value for how long the app has been installed (by default, counted in days). eg 5
userType
Pass back either the user type Pay or Non-Pay. This is the class PJUserType
as defined in PJUserType.cs
tags
(optional) Set to null if you aren't using them. If your app uses tags to select polls, pass them in string format with as many as you want to send - TAG,TAG, ... ,TAG
. TAG is either in the format TAGNAME or TAGNAME:VALUE. They should match what you defined in the web console. An example of sending back player gender, current energy and where the poll is being called from could be: MALE,ENERGY#18,PVPMENU
delegate
(optional) Set to null if not needed. Delegate is the instance to handle all callbacks from polljoy SDK. If used, the delegate should implement PolljoyDelegate
as defined in Polljoy.cs
Callbacks
To use the delegate and callbacks, please extend the method "PolljoyDelegate" and implement the callback methods.
polljoy will inform delegate at different stages when the polls are downloaded, ready to show, user responded etc. The app can optionally implement the delegate methods to control the app logic. The delegate methods are (defined in PolljoyDelegate.cs):
void PJPollNotAvailable(PJResponseStatus status);
When there is no poll matching your selection criteria or no more polls to show in the current session. The error code is passed back as a enum.
void PJPollIsReady(List<PJPoll> polls);
When poll/s is/are ready to show (including all associated images). Friendly tip - If you are displaying the poll in the middle of an active app or app session that needs real time control, consider to pause your app before presenting the poll UI as needed.
The polls array returned are all the matched polls for the request. Please refer PJPoll.cs
for the data structure.
When you’re ready to present the poll, call:
This will present the polljoy UI according to your app style and poll settings. Then the SDK will handle all the remaining tasks for you. These include handling the user’s response, informing delegate for any virtual amount user received, uploading the result to the console … etc.
We recommend you implement this delegate method so you know when polls are ready and call polljoy SDK to show the poll or do whatever control you need.
void PJPollWillShow(PJPoll poll);
The polljoy poll UI is ready and will show. You can do whatever UI control as needed. Or simply ignore this implementation.
void PJPollDidShow(PJPoll poll);
The polljoy poll UI is ready and has shown. You can do whatever UI control as needed. Or simply ignore this implementation.
void PJPollWillDismiss(PJPoll poll);
The polljoy poll UI is finished and will dismiss. You can do whatever UI control as needed. Or simply ignore this implementation. You can prepare your own UI before resuming your app before the polljoy poll UI is dismissed.
void PJPollDidDismiss(PJPoll poll);
The polljoy poll UI is finished and has dismissed. You can do whatever UI control as needed. Or simply ignore this implementation. You can prepare your own UI to resume your app before the polljoy UI is dismissed. This is the last callback from polljoy and all polls are completed. You should resume your app if you have paused.
void PJPollDidResponded(PJPoll poll);
User has responded to the poll. The poll will contain all the poll data including user’s responses. You can ignore this (the results are displayed in the web admin console and able to be exported) or use it as you wish.
If you issue a virtual currency amount to user, you MUST implement this method to handle the virtual amount issued. This is the only callback from SDK that informs the app the virtual amount that the user collected.
void PJPollDidSkipped(PJPoll poll);
If the poll is not mandatory, the user can choose to skip the poll. You can handle this case or simply ignore it safely.
Device ID
By default the SDK will assign an unique device ID to each device, if you would however like to override this and assign the device ID yourself, call this method instead
// ...
public class ApplicationStart : MonoBehaviour
// ...
Polljoy.startSession("YOUR_APP_ID", "DEVICE_ID"); // This is the APP ID for the app
// ...
That's it! Email us at help@polljoy.com if you have questions or suggestions!