In app notitfication not working

0 votes

Hi All,

I want to implement in app notification in my application. For this i had written in my activity:

 

App42API.initialize(this, Constants.API_KEY,Constants.SECRET_KEY);
        App42API.enableEventService(true);
        App42API.setLoggedInUser(UserName) ;
        App42CampaignAPI.initWithListener(new InAppListener(), 5);
App42CampaignAPI.enable(true);
App42CampaignAPI.setActivityContext(this);

 

I had created In -app Campaign and filled all filed like frequency,start and date . But it is not showing in my application. Any suggestion. Also tried on Install Event

 

 

 

asked Mar 24, 2017 in Android by pramod.deore (10 points)

1 Answer

0 votes

Hi Pramod,

Greetings from ShepHertz!!

As Install event is fired while application is open very first time, its not being triggered again.

Please configure inApp on event those are inside your application. It will show when respective user do that event.

Let me know if it helps.

Regards

Vishnu Garg

answered Mar 27, 2017 by Vishnu Garg (674 points)
Hi Vishnu,

Thanks for your response. I had added install event and other event also. Events are also visible on dashboard. I had uninstalled application after setting event and when I start it it suppose to fire as user is first time opening the application, but it is not visible. It is also not visible after other event triggered. But other event count increases on dashboard.
Please use event inside your application. It has certain steps.
First while app open it fetch inApp details from app42 than validate respective campign with the user you have set. And then when the respective event trigger it will show the In App.
Hi Vishnu, Thanks for your suggestion. I am using event inside my application. For event tracking I am using following code:

String eventName = "Test";
JSONObject properties = new JSONObject ();
properties.put ("Name", "Demo");
eventService.trackEvent(eventName, properties, new App42CallBack() {
public void onSuccess(Object response)
{
    App42Response app42Response = (App42Response) response;   
    System.out.println("App42Response Is : " + app42Response);
}
public void onException(Exception ex)
{
    System.out.println("Exception Message"+ex.getMessage());
}
});   

Here it goes inside success and event count increases by 1 for event name "Test". But in system.out.println it prints App42Response Is null. And In app notification does not appears. It also shows estimated user count for this Inapp campaign.
Yes, App42Response is null you can check only success status. It doesn't has any values.
Please set App42Log.setDebug(true); and search your campaign Name is logs and share the same. So that I can trace the problem.
Following is log for Feedback campaigns:

Json String : {"app42":{"event":{"superProperties":{"app42_os_version":"4.4.2","app42_installAt":"2017-03-27T07:32:43.469Z","app42_lastCommunicatedAt":"2017-03-27T07:50:57.622Z","app42_model":"SM-G7102","app42_carrier":"","app42_screen_width":720,"app42_counter":1,"app42_screen_height":1280,"app42_brand":"samsung","app42_lib_version":"1.0","app42_app_version":"1.6.0.0","app42_screen_dpi":320,"app42_os":"Android"},"userProperties":{"Email":"test@gmail.com","Name":"s0002","Feedback":"testingggg in app"},"app42_userUpdatedOn":"2017-03-27T07:32:43.470Z","eventName":"Feedback Submitted","installProperties":{},"app42_lastCommunicatedAt":"2017-03-27T07:50:57.622Z"}}}
03-27 13:44:41.299 24932-4948/com.iifl.mf I/System.out: sortedparams: apiKey844500e410e6803276880a2727de53dc0d67efa97a12f4456b4974ae6ad47a66body{"app42":{"event":{"superProperties":{"app42_os_version":"4.4.2","app42_installAt":"2017-03-27T07:32:43.469Z","app42_lastCommunicatedAt":"2017-03-27T07:50:57.622Z","app42_model":"SM-G7102","app42_carrier":"","app42_screen_width":720,"app42_counter":1,"app42_screen_height":1280,"app42_brand":"samsung","app42_lib_version":"1.0","app42_app_version":"1.6.0.0","app42_screen_dpi":320,"app42_os":"Android"},"userProperties":{"Email":"test@gmail.com","Name":"s0002","Feedback":"testingggg in app"},"app42_userUpdatedOn":"2017-03-27T07:32:43.470Z","eventName":"Feedback Submitted","installProperties":{},"app42_lastCommunicatedAt":"2017-03-27T07:50:57.622Z"}}}timeStamp2017-03-27T08:14:41.305Zversion1.0
03-27 13:44:41.309 24932-4948/com.iifl.mf I/System.out: Post URL is https://analytics.shephertz.com/cloud/1.0/event?
03-27 13:44:41.309 24932-4948/com.iifl.mf I/System.out:  Setting Header value : deviceId : ec7198f2b677ccdf
03-27 13:44:41.309 24932-4948/com.iifl.mf I/System.out:  Setting Header value : signature : gzuOX8yW6T5dCJrhMKHfOHaKrWY%3D
03-27 13:44:41.309 24932-4948/com.iifl.mf I/System.out:  Setting Header value : apiKey : 844500e410e6803276880a2727de53dc0d67efa97a12f4456b4974ae6ad47a66
03-27 13:44:41.309 24932-4948/com.iifl.mf I/System.out:  Setting Header value : loggedInUser : <Logged In User>
03-27 13:44:41.309 24932-4948/com.iifl.mf I/System.out:  Setting Header value : SDKName : Android
03-27 13:44:41.309 24932-4948/com.iifl.mf I/System.out:  Setting Header value : version : 1.0
03-27 13:44:41.309 24932-4948/com.iifl.mf I/System.out:  Setting Header value : timeStamp : 2017-03-27T08:14:41.305Z


PostResponse is {"success":true,"campaigns":[{"name":"InAppTest","isAvailable":true}]}
03-27 13:44:42.719 24932-4947/com.iifl.mf I/System.out: Eigible Campaigns--{"success":true,"campaigns":[{"name":"InAppTest","isAvailable":true}]}
03-27 13:44:58.029 24932-4948/com.iifl.mf I/System.out: Thread-2242 calls detatch()
03-27 13:44:58.029 24932-4948/com.iifl.mf I/System.out:  PostResponse is {"app42":{"response":{"success":true,"event":{"lastCommunicatedAt":"2017-03-27T08:14:40.221Z","name":"FEEDBACK SUBMITTED","type":"EVENT"}}}}
03-27 13:44:58.029 24932-4948/com.iifl.mf I/System.out: Event has been occured--FEEDBACK SUBMITTED
03-27 13:44:58.039 24932-4948/com.iifl.mf I/System.out: Event JSOn--{"campaignName":"InAppTest","type":"Alert","content":{"message":"R u intrested in MF","titleText":"IIFL MF","okBtnText":"Yes","couponCode":""}}
03-27 13:44:58.039 24932-4948/com.iifl.mf I/System.out: No Campaigns are found
03-27 13:44:58.039 24932-4948/com.iifl.mf I/System.out: Response : {"app42":{"response":{"success":true,"event":{"lastCommunicatedAt":"2017-03-27T08:14:40.221Z","name":"FEEDBACK SUBMITTED","type":"EVENT"}}}}
Please initialize the SDK in in Application class that extends App42Application.also declare the same in AndroidManifest.xml file. As I am able to see that alert content is there but unable to show may be due to UI context is not available.
Hi Vishnu, My Application class extends App42Application and  also present in Manifest.

I think problem is I am getting SocketTimeoutException in response. at the end of response:

sortedparams: apiKey844500e410e6803276880a2727de53dc0d67efa97a12f4456b4974ae6ad47a66body{"app42":{"event":{"superProperties":{"app42_os_version":"4.4.2","app42_installAt":"2017-03-27T09:51:37.912Z","app42_lastCommunicatedAt":"2017-03-27T09:59:24.456Z","app42_model":"SM-G7102","app42_carrier":"","app42_screen_width":720,"app42_counter":1,"app42_screen_height":1280,"app42_brand":"samsung","app42_lib_version":"1.0","app42_app_version":"1.6.0.0","app42_screen_dpi":320,"app42_os":"Android"},"userProperties":{"Email":"test@gmail.com","Name":"s0002","Feedback":"hiiiiiiiii test feedback....."},"app42_userUpdatedOn":"2017-03-27T09:51:31.387Z","eventName":"Feedback Submitted","installProperties":{},"app42_lastCommunicatedAt":""}}}timeStamp2017-03-27T10:00:05.779Zversion1.0
03-27 15:30:05.766 10904-3833/com.iifl.mf I/System.out: Post URL is https://analytics.shephertz.com/cloud/1.0/event?
03-27 15:30:05.766 10904-3833/com.iifl.mf I/System.out:  Setting Header value : deviceId : ec7198f2b677ccdf
03-27 15:30:05.766 10904-3833/com.iifl.mf I/System.out:  Setting Header value : signature : IlkUGyY9Sdbh%2F68dffu9SMEO460%3D
03-27 15:30:05.766 10904-3833/com.iifl.mf I/System.out:  Setting Header value : apiKey : 844500e410e6803276880a2727de53dc0d67efa97a12f4456b4974ae6ad47a66
03-27 15:30:05.766 10904-3833/com.iifl.mf I/System.out:  Setting Header value : loggedInUser : <Logged In User>
03-27 15:30:05.766 10904-3833/com.iifl.mf I/System.out:  Setting Header value : SDKName : Android
03-27 15:30:05.766 10904-3833/com.iifl.mf I/System.out:  Setting Header value : version : 1.0
03-27 15:30:05.766 10904-3833/com.iifl.mf I/System.out:  Setting Header value : timeStamp : 2017-03-27T10:00:05.779Z
03-27 15:30:07.806 10904-3832/com.iifl.mf I/System.out: Thread-2570 calls detatch()
03-27 15:30:07.806 10904-3832/com.iifl.mf I/System.out:  GetResponse is {"success":true,"campaigns":[],"downloads":[],"priorities":[]}
03-27 15:30:07.806 10904-3832/com.iifl.mf I/System.out: {"priorities":[]}
03-27 15:30:07.806 10904-3832/com.iifl.mf I/System.out: Absoulute Config Path/data/data/com.iifl.mf/cache/viralityConfig/virality.json
03-27 15:30:09.456 10904-3831/com.iifl.mf I/System.out: Thread-2569 calls detatch()
03-27 15:30:09.456 10904-3831/com.iifl.mf I/System.out:  GetResponse is {"success":true,"campaigns":[{"startDate":"2017-03-27T00:00:00.000Z","frequency":{"value":"20","type":"Daily"},"campaignName":"Feedback","when":{"events":["FEEDBACK SUBMITTED"]},"endDate":"2017-03-27T15:00:00.000Z","what":{"type":"Alert","content":{"titleText":"IIFL MF","okBtnText":"Ok","message":"You  want to invest in MF?","couponCode":""}},"locations":{},"superProperties":{},"installProperties":{}},{"startDate":"2017-03-27T00:00:00.000Z","frequency":{"value":"20","type":"Daily"},"campaignName":"InAppTest","when":{"events":["FEEDBACK SUBMITTED"]},"endDate":"2017-03-27T16:00:00.000Z","what":{"type":"Alert","content":{"titleText":"IIFL MF","okBtnText":"Yes","message":"R u intrested in MF","couponCode":""}},"locations":{},"superProperties":{},"installProperties":{}}],"downloads":[],"priorities":["Feedback","InAppTest"]}
03-27 15:30:09.466 10904-3831/com.iifl.mf I/System.out: {"priorities":["InAppTest"],"subscribedEvents":{"FEEDBACK SUBMITTED":["InAppTest"]},"InAppTest":{"campaignName":"InAppTest","startDate":1490553000000,"installProperties":{},"locations":{},"what":{"content":{"message":"R u intrested in MF","okBtnText":"Yes","titleText":"IIFL MF","couponCode":""},"type":"Alert"},"when":{"events":["FEEDBACK SUBMITTED"]},"superProperties":{},"endDate":1490610600000,"frequency":{"type":"Daily","value":"20"}},"downloads":[],"version":"1.0"}
03-27 15:30:09.916 10904-3831/com.iifl.mf I/System.out: Absoulute Config Path/data/data/com.iifl.mf/cache/inAppConfig/config.json
03-27 15:30:09.936 10904-4031/com.iifl.mf I/System.out: Images are downloaded
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out: {"app42":{"campaigns":"{\"campaign\":[\"InAppTest\"]}"}}
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out:  Json String : {"app42":{"campaigns":"{\"campaign\":[\"InAppTest\"]}"}}
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out: sortedparams: apiKey844500e410e6803276880a2727de53dc0d67efa97a12f4456b4974ae6ad47a66body{"app42":{"campaigns":"{\"campaign\":[\"InAppTest\"]}"}}timeStamp2017-03-27T10:00:09.948Zversion1.0
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out: Post URL is https://analytics.shephertz.com/cloud/1.0/event/isAvailable?
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out:  Setting Header value : deviceId : ec7198f2b677ccdf
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out:  Setting Header value : signature : bdhiwnBroQbzgeaOJRPluz%2Bbeq0%3D
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out:  Setting Header value : apiKey : 844500e410e6803276880a2727de53dc0d67efa97a12f4456b4974ae6ad47a66
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out:  Setting Header value : loggedInUser : <Logged In User>
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out:  Setting Header value : SDKName : Android
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out:  Setting Header value : version : 1.0
03-27 15:30:09.936 10904-4045/com.iifl.mf I/System.out:  Setting Header value : timeStamp : 2017-03-27T10:00:09.948Z
03-27 15:30:11.416 10904-4045/com.iifl.mf I/System.out: Thread-2574 calls detatch()
03-27 15:30:11.416 10904-4045/com.iifl.mf I/System.out:  PostResponse is {"success":true,"campaigns":[{"name":"InAppTest","isAvailable":true}]}
03-27 15:30:11.416 10904-4045/com.iifl.mf I/System.out: Eigible Campaigns--{"success":true,"campaigns":[{"name":"InAppTest","isAvailable":true}]}
03-27 15:31:07.936 10904-3833/com.iifl.mf I/System.out: Thread-2571 calls detatch()
03-27 15:31:08.046 10904-3833/com.iifl.mf D/dalvikvm: GC_FOR_ALLOC freed 2927K, 48% free 16510K/31492K, paused 112ms, total 113ms
03-27 15:31:08.046 10904-3833/com.iifl.mf I/System.out:  Exception :com.shephertz.app42.paas.sdk.android.App42Exception: java.net.SocketTimeoutException: Read timed out
03-27 15:31:08.046 10904-3833/com.iifl.mf I/System.out: Exception Messagejava.net.SocketTimeoutException: Read timed out
Hi Vishnu thanks for your time,

It is visible now. Mostly it is throwing socket time out exception. When It is not throw exception then it is showing in app notification. But there is some issue because of that socket time out exception occurs.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...