@Singleton
public class Netmera
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
disablePopupPresentation()
Disable Netmera to present received popups.
|
static void |
disablePush()
Disable push notification for this device.
|
static void |
enablePopupPresentation()
Enable Netmera to present received popups immediately.
|
static void |
enablePush()
Enable push notification for this device.
|
static void |
fetchInbox(NetmeraInboxFilter filter,
NetmeraInbox.NetmeraInboxFetchCallback callback)
Fetch list of push notifications matching with given filter from Netmera.
|
static void |
handlePushObject(android.app.Activity activity,
NetmeraPushObject netmeraPushObject)
Perform push object's action or show a simple dialog with action buttons according to push
type
When this method is called, if push object has action buttons, a simple dialog with buttons
will be shown.
|
static void |
handleWebContent(android.webkit.WebView webView)
Load contents of the web view action of recent push notification in given web view.
|
static void |
handleWebContent(android.webkit.WebView webView,
NetmeraWebViewCallback netmeraWebViewCallback)
Load contents of the web view action of recent push notification in given web view and
delegates
WebViewClient.shouldOverrideUrlLoading(WebView, String) }
method calls to given callback. |
static void |
init(android.content.Context context,
java.lang.String gcmSenderId)
Initialize the Netmera instance.
|
static void |
init(android.content.Context context,
java.lang.String gcmSenderId,
java.lang.String apiKey)
Initialize the Netmera instance.
|
static boolean |
isPushEnabled()
Check push notification state.
|
static void |
logging(boolean enabled)
Change logging state.
|
void |
onActivityChanged(android.app.Activity activity) |
void |
onBackground() |
void |
onClose() |
void |
onForeground() |
void |
onNetworkResponse(RequestBase request,
ResponseBase response,
NetmeraError error) |
void |
onOpen() |
static void |
requestPermissionsForLocation()
Request location permissions from user (For Android version level 23 and above).
|
static <T extends NetmeraEvent> |
sendEvent(T netmeraEvent)
Send an event to Netmera servers.
|
static void |
setApiKey(java.lang.String apiKey)
Set given Netmera SDK API key.
|
static void |
setBaseUrl(java.lang.String url)
Changes base API URL to given URL string.
|
static void |
setNetmeraMaxActiveRegions(int netmeraMaxActiveRegions)
Request maximum active geofence region from user
If user sets max active regions' number greater than 100 or smaller than 0, it will be set as the default which is 100
|
static void |
turnOffSendingEventAndUserUpdate(boolean turnOff)
Completely turn off sending all events and user data.
|
static <T extends NetmeraUser> |
updateUser(T netmeraUser)
Set or update the attributes of the user in Netmera.
|
public static void init(android.content.Context context, java.lang.String gcmSenderId)
setApiKey(String)
method. Otherwise, use init(Context, String,
String)
In order for Netmera to operate correctly, this method must definitely be called in the
Application.onCreate()
method.context
- Application context to be used for storage operations and accessing Google
Play ServicesgcmSenderId
- Application specific API key gathered from Netmera panel.public static void init(android.content.Context context, @NonNull java.lang.String gcmSenderId, java.lang.String apiKey)
Application.onCreate()
method.context
- Application context to be used for storage operations and accessing Google
Play ServicesgcmSenderId
- Sender Id of the Google project for which push token will be takenapiKey
- Application specific API key gathered from Netmera panel.public static void logging(boolean enabled)
enabled
- Flag for logging state.public static void setBaseUrl(java.lang.String url)
url
- Custom domain string.public static void setApiKey(java.lang.String apiKey)
apiKey
- Application specific API key gathered from Netmera panel.public static void turnOffSendingEventAndUserUpdate(boolean turnOff)
NetmeraUser
updates and NetmeraEvent
s will never be sent to server.
turnOff
- Flag for opt-out user data and events. Default value is false.public static <T extends NetmeraEvent> void sendEvent(@NonNull T netmeraEvent)
NetmeraEvent
class. This approach provides Netmera to verify type of
the given event attributes, which is crucial during event analytics operations on Netmera
servers.netmeraEvent
- An event object which is subclass of NetmeraEvent
NetmeraEvent} subclasses for usage examples.
public static <T extends NetmeraUser> void updateUser(T netmeraUser)
null
object
to the corresponding attribute on user object.netmeraUser
- NetmeraUser
object for setting user related attributespublic static void enablePush()
disablePush()
, it can be re-enabled via this method.public static void disablePush()
public static boolean isPushEnabled()
public static void enablePopupPresentation()
disablePopupPresentation()
method.
If a popup style notification has been received during the time at which popup presentation was
disabled, it will be shown immediately after you call this method.
If multiple popup notifications have been received, only the most recent one will be
presented.public static void disablePopupPresentation()
enablePopupPresentation()
.public static void handleWebContent(@NonNull android.webkit.WebView webView)
WebView
object.
If you need to be notified about WebViewClient.shouldOverrideUrlLoading(WebView,
String)
} method calls, you should use handleWebContent(WebView,
NetmeraWebViewCallback)
method.webView
- A WebView instance upon which related HTML content will be loaded.public static void handleWebContent(@NonNull android.webkit.WebView webView, NetmeraWebViewCallback netmeraWebViewCallback)
WebViewClient.shouldOverrideUrlLoading(WebView, String)
}
method calls to given callback.
When this method is called, Netmera will immediately load the contents of the web view action
inside given WebView
object.webView
- A WebView instance upon which related HTML content will be
loaded.netmeraWebViewCallback
- A callback instance which will be called for url loadingspublic static void handlePushObject(@NonNull android.app.Activity activity, @NonNull NetmeraPushObject netmeraPushObject)
activity
- The activity in which dialog will be shown.netmeraPushObject
- Push object instance to processpublic static void fetchInbox(@NonNull NetmeraInboxFilter filter, @NonNull NetmeraInbox.NetmeraInboxFetchCallback callback)
NetmeraInbox
object or with a non-null
NetmeraError
object if fetch operation has failed.
Use returned NetmeraInbox object for future operations on the inbox such as accessing the
objects, fetching next pages of the inbox list, and modifying the status of objects.filter
- A NetmeraInboxFilter
object defining the filter options for the list of
push objects to be returned from server.callback
- A NetmeraInbox.NetmeraInboxFetchCallback
to be triggered after fetch
process is completed.class for the possible filtering options.
public static void requestPermissionsForLocation()
public static void setNetmeraMaxActiveRegions(int netmeraMaxActiveRegions)
netmeraMaxActiveRegions
- Maximum Netmera active geofence regionspublic void onNetworkResponse(RequestBase request, ResponseBase response, NetmeraError error)
public void onOpen()
public void onForeground()
public void onBackground()
public void onClose()
public void onActivityChanged(android.app.Activity activity)