Netmera Pop-up

Pop-ups are very helpful in increasing in-app communication. They are shown according to user actions such as app opens, specific page views, or other valuable custom actions that you have decided. Best thing about Netmera pop-up service is that you do not need to change anything in your app to change the message that is displayed. Each time the user opens the app; Netmera SDK will download the latest pop-up rules and display the current message.

Registration and Initialization

To be able to use Netmera Pop-up, you should enable pop-up retrieval on start-up using netmera.properties file or NetmeraProperties class. See Initialization for more.

Netmera will retrieve pop-ups automatically.

Pop-up will be triggered by events. For example, if user opens the app and if there is any pop-up triggered by open app event, you can show it to user. Netmera will not show pop ups automatically after these events.

Netmera will index pop-ups to show when and where ever you want.

Checking Pop-ups

In your each view opened, you need to set a PopupStateListener. This listener has two methods. One is named as onReady() and it is to be informed after the pop-up list is ready to use. Other method is onEvent(List<NetmeraPopup>) and it is called after an event sent to Netmera and if there is a pop-up triggered by this event.

You can use the listener as shown below.

NetmeraPopupService.setPopupStateListener(new PopupStateListener() {
    @Override
    public void onReady() {
        //Pop-up list retrieved from Netmera successfully
    }

    @Override
    public void onEvent(List<NetmeraPopup> popups, String eventType) {
	try {
            //Handle your pop-ups here
            popups.get(0).show(yourWebView); 
        } catch (Exception e) { 
            e.printStackTrace(); 
        } 
    } 
});

You can check if there is any pop up to show by calling the code below.

boolean appHasPopup = NetmeraPopupService.appHasPopupToShow();

If you want to check pop ups for a specific event, call this method.

boolean appHasPopup = NetmeraPopupService.appHasPopupToShow(String);

String parameter in the method is event name. You may want to check pop-ups for your custom events or Netmera default events. For Netmera event type names, use variables defined on EventType class. There is 1 event which is sent automatically by Netmera for now. Namely;


APP_OPENED: When application is opened and you called NetmeraEvent.onStart(Activity) method from onStart() methods of your activities.

Getting Deserved Pop-ups

If you want to get events in a method other than onEvent of the listener, you need some more code.

If there is any pop-up to show (user sent some event and deserved to see any pop-up) and you want to show it, get pop-up list by using the following method.

List<NetmeraPopup> popupList = NetmeraPopupService.getAllPopupsToShow();

This method will return all deserved pop ups. However, you may want to get pop ups which are related with some events. In a situation like this, you should use the following method. You can use variable defined on EventType class for the parameter event name or your custom event name.

List<NetmeraPopup> popupList = NetmeraPopupService.getEventRelatedPopupsToShow(String);
Showing a Pop-up

From the list, you should choose which pop up you want to show. You can define more than one pop up for each event and that is why these methods return list instead of one unique NetmeraPopup object.

After selecting a pop-up, you should call one of show(); methods on NetmeraPopup class.

There are 2 methods to show pop ups. One of them takes Activity as parameter. Netmera will add pop up to this activity and show it. You should call this method from the same activity which is given as parameter activity to the method. Usage of the method may be like this:

popup.show(this);

The other show(); method takes WebView as parameter. You can give Netmera a WebView. Current pop-up will be shown in this WebView.

popup.show(webview);

March 31, 2015 / parag

Recent Blog Posts
ROI based app marketing for your business
App Indexing: some insights
Categories