{"action":"created","issue":{"url":"https://api.github.com/repos/Appboy/appboy-android-sdk/issues/57","repository_url":"https://api.github.com/repos/Appboy/appboy-android-sdk","labels_url":"https://api.github.com/repos/Appboy/appboy-android-sdk/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/Appboy/appboy-android-sdk/issues/57/comments","events_url":"https://api.github.com/repos/Appboy/appboy-android-sdk/issues/57/events","html_url":"https://github.com/Appboy/appboy-android-sdk/issues/57","id":172119583,"number":57,"title":"React Native 0.31 & Android In-App Messages","user":{"login":"jasonagnew","id":5786790,"avatar_url":"https://avatars.githubusercontent.com/u/5786790?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonagnew","html_url":"https://github.com/jasonagnew","followers_url":"https://api.github.com/users/jasonagnew/followers","following_url":"https://api.github.com/users/jasonagnew/following{/other_user}","gists_url":"https://api.github.com/users/jasonagnew/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonagnew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonagnew/subscriptions","organizations_url":"https://api.github.com/users/jasonagnew/orgs","repos_url":"https://api.github.com/users/jasonagnew/repos","events_url":"https://api.github.com/users/jasonagnew/events{/privacy}","received_events_url":"https://api.github.com/users/jasonagnew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-19T12:23:08Z","updated_at":"2016-08-25T13:36:50Z","closed_at":null,"body":"I've implemented your platform into both iOS & Android, and managed to get Push Noficiations working on both iOS & Android pretty easy. I finished up adding In-App messaging to iOS yesterday and today moved on to Android, which for some reason doesn't appear to work. I'm using:\r\n\r\n```\r\nReact 0.31\r\nAppboy SDK 1.14.1\r\nAndroid Min SDK Version 19 \r\nTesting on Device Android v6.0.1\r\n```\r\n\r\n>Please Note: I'm not using `Appboy.getInstance(this).requestInAppMessageRefresh();` as it says its `Deprecated` [here]\r\n(https://appboy.github.io/appboy-android-sdk/javadocs/com/appboy/Appboy.html) even though it says to use it your [documentation](https://www.appboy.com/documentation/Android/#part-3-implementation-example)\r\n\r\nOn my `MainActivity.java` I added:\r\n```\r\n    @Override\r\n    public void onResume() {\r\n      super.onResume();\r\n      AppboyInAppMessageManager.getInstance().registerInAppMessageManager(this);\r\n      Log.e(\"MainActivity\", \"registerInAppMessageManager\");\r\n    }\r\n\r\n    @Override\r\n    public void onPause() {\r\n      super.onPause();\r\n      AppboyInAppMessageManager.getInstance().unregisterInAppMessageManager(this);\r\n      Log.e(\"MainActivity\", \"unregisterInAppMessageManager\");\r\n    }\r\n```\r\nWhich I've checked correctly registers and unregisters the `AppboyInAppMessageManager`. However, In-App messages don't show, you can see there received:\r\n\r\n```\r\nReceived broadcast message. Message: Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10 pkg=com.xxx cmp=com.xxx/com.appboy.AppboyGcmReceiver (has extras) }\r\n```\r\n\r\nIf you click on the noficiation `Appboy Test Send` it will correctly show the In-App message. I decided to see if I could get the function `beforeInAppMessageDisplayed` to run like we've used on iOS so I created a `ReactContextBaseJavaModule`:\r\n\r\n```\r\npublic class AppboyInAppMessagesModule extends ReactContextBaseJavaModule implements IInAppMessageManagerListener {\r\n\r\n    public AppboyInAppMessagesModule(ReactApplicationContext reactContext) {\r\n        super(reactContext);\r\n    }\r\n\r\n    @Override\r\n    public String getName() {\r\n        return \"AppboyInAppMessages\";\r\n    }\r\n\r\n    @Override\r\n    public boolean onInAppMessageReceived(IInAppMessage inAppMessage) {\r\n      return false;\r\n    }\r\n\r\n    @Override\r\n    public InAppMessageOperation beforeInAppMessageDisplayed(IInAppMessage inAppMessage) {\r\n      Log.e(\"AppboyInAppMessagesModule\", \"beforeInAppMessageDisplayed\");\r\n      return InAppMessageOperation.DISPLAY_NOW;\r\n    }\r\n\r\n    @Override\r\n    public boolean onInAppMessageClicked(IInAppMessage inAppMessage, InAppMessageCloser inAppMessageCloser) {\r\n      return true;\r\n    }\r\n\r\n    @Override\r\n    public boolean onInAppMessageButtonClicked(MessageButton button, InAppMessageCloser inAppMessageCloser) {\r\n      return true;\r\n    }\r\n\r\n    @Override\r\n    public void onInAppMessageDismissed(IInAppMessage inAppMessage) {}\r\n\r\n}\r\n```\r\nBut unfortunately `beforeInAppMessageDisplayed` is never fired. Any advice you could offer would be great, pehraps I've missed something small. Thanks"},"comment":{"url":"https://api.github.com/repos/Appboy/appboy-android-sdk/issues/comments/242388561","html_url":"https://github.com/Appboy/appboy-android-sdk/issues/57#issuecomment-242388561","issue_url":"https://api.github.com/repos/Appboy/appboy-android-sdk/issues/57","id":242388561,"user":{"login":"jasonagnew","id":5786790,"avatar_url":"https://avatars.githubusercontent.com/u/5786790?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonagnew","html_url":"https://github.com/jasonagnew","followers_url":"https://api.github.com/users/jasonagnew/followers","following_url":"https://api.github.com/users/jasonagnew/following{/other_user}","gists_url":"https://api.github.com/users/jasonagnew/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonagnew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonagnew/subscriptions","organizations_url":"https://api.github.com/users/jasonagnew/orgs","repos_url":"https://api.github.com/users/jasonagnew/repos","events_url":"https://api.github.com/users/jasonagnew/events{/privacy}","received_events_url":"https://api.github.com/users/jasonagnew/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T13:36:50Z","updated_at":"2016-08-25T13:36:50Z","body":"On my final bit of testing I wanted to see if I could register my own `InAppMessageEventSubscriber` that way I could see if its the case of `InAppMessageEvent` events not being triggered. Which seems to be the case as I received no output.\r\n\r\nI added the following method to my `MainActivity.java`\r\n\r\n```\r\nprivate IEventSubscriber<InAppMessageEvent> createInAppMessageEventSubscriber() {\r\n  Log.e(\"MainActivity\", \"createInAppMessageEventSubscriber\");\r\n  return new IEventSubscriber<InAppMessageEvent>() {\r\n    @Override\r\n    public void trigger(InAppMessageEvent event) {\r\n      Log.e(\"MainActivity\", \"addInAppMessage\");\r\n      AppboyInAppMessageManager.getInstance().addInAppMessage(event.getInAppMessage());\r\n    }\r\n  };\r\n}\r\n```\r\nThen added this to my `onResume` method\r\n\r\n```\r\nAppboy.getInstance(this.getApplicationContext()).subscribeToNewInAppMessages(this.createInAppMessageEventSubscriber());\r\n```\r\n\r\nAnd my logs show up to `createInAppMessageEventSubscriber` but never shows `addInAppMessage`:\r\n\r\n```\r\n08-25 14:27:20.408 18497-18497/com.xxx E/MainActivity: setCustomInAppMessageManagerListener\r\n08-25 14:27:20.433 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.ci: Missing permission. The android.permission.GET_ACCOUNTS permission is recommended to be set so that pre-Jelly Bean Android devices can register with the GCM server.\r\n08-25 14:27:20.435 18497-18497/com.xxx I/Appboy v1.14.1 .com.appboy.Appboy: Google Cloud Messaging found.  Setting up Google Cloud Messaging\r\n08-25 14:27:20.438 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.bw: com.amazon.device.messaging.ADM not found\r\n08-25 14:27:20.447 18497-18497/com.xxx I/art: Rejecting re-init on previously-failed class java.lang.Class<com.appboy.services.AppboyWearableListenerService>\r\n08-25 14:27:20.447 18497-18497/com.xxx I/art: Rejecting re-init on previously-failed class java.lang.Class<com.appboy.services.AppboyWearableListenerService>\r\n08-25 14:27:20.447 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.cf: AppboyWearableListenerService not found on path. Service not available.\r\n08-25 14:27:20.448 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.cf: Appboy Wearable service is not available. Declare <service android:name=\"com.appboy.services.AppboyWearableListenerService\"/> in your appboy.xml to enable Appboy wearable service. See the Droidboy manifest for an example\r\n08-25 14:27:20.476 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.by: Location collection enabled via appboy.xml configuration.\r\n08-25 14:27:20.476 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.by: Background location collection disabled via appboy.xml configuration.\r\n08-25 14:27:20.477 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.by: Appboy location service is not available. Declare <service android:name=\"com.appboy.services.AppboyLocationService\"/> in your AndroidManifest.xml to enable Appboy location service.\r\n08-25 14:27:20.477 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.by: Time interval override set to default for background location collection: 3600s.\r\n08-25 14:27:20.478 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.by: Distance threshold override set to default for background location collection: 50.0m.\r\n08-25 14:27:20.480 18497-18497/com.xxx I/Appboy v1.14.1 .bo.app.by: Did not attempt to stop service. Appboy Location service is not available.\r\n08-25 14:27:20.483 18497-18546/com.xxx I/Appboy v1.14.1 .bo.app.du: No piq requests queued.\r\n08-25 14:27:20.486 18497-18497/com.xxx E/MainActivity: registerInAppMessageManager\r\n08-25 14:27:20.486 18497-18497/com.xxx E/MainActivity: createInAppMessageEventSubscriber\r\n08-25 14:27:20.495 18497-18550/com.xxx I/Appboy v1.14.1 .bo.app.fc: Found 1 sealed session rows.\r\n08-25 14:27:20.498 18497-18551/com.xxx D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true\r\n08-25 14:27:20.534 18497-18497/com.xxx W/unknown:React: You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.\r\n08-25 14:27:22.215 18497-18568/com.xxx I/ReactNativeJS: Running application \"EvE\" with appParams: {\"initialProps\":{},\"rootTag\":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF\r\n08-25 14:27:22.465 18497-18568/com.xxx I/ReactNativeJS: '', 'Get user called with id fS7L7Fscwpo'\r\n08-25 14:27:22.485 18497-18568/com.xxx I/ReactNativeJS: '', 'user already onboard'\r\n08-25 14:27:25.319 18497-18643/com.xxx I/WebViewFactory: Loading com.google.android.webview version 52.0.2743.98 (code 275609800)\r\n08-25 14:27:25.403 18497-18643/com.xxx I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>\r\n08-25 14:27:25.403 18497-18643/com.xxx I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>\r\n08-25 14:27:25.406 18497-18643/com.xxx I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>\r\n08-25 14:27:25.407 18497-18643/com.xxx I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>\r\n08-25 14:27:25.420 18497-18643/com.xxx I/cr_LibraryLoader: Time to load native libraries: 3 ms (timestamps 1818-1821)\r\n08-25 14:27:25.420 18497-18643/com.xxx I/cr_LibraryLoader: Expected native library version number \"52.0.2743.98\", actual native library version number \"52.0.2743.98\"\r\n08-25 14:27:25.617 18497-18507/com.xxx I/art: Background sticky concurrent mark sweep GC freed 46900(2MB) AllocSpace objects, 14(328KB) LOS objects, 0% free, 56MB/56MB, paused 4.039ms total 102.439ms\r\n08-25 14:27:25.711 18497-18507/com.xxx W/art: Suspending all threads took: 7.683ms\r\n08-25 14:27:25.747 18497-18507/com.xxx I/art: Background partial concurrent mark sweep GC freed 9160(492KB) AllocSpace objects, 9(180KB) LOS objects, 20% free, 60MB/76MB, paused 11.524ms total 114.539ms\r\n08-25 14:27:37.848 18497-18497/com.xxx I/Appboy v1.14.1 .com.appboy.AppboyGcmReceiver: Received broadcast message. Message: Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10 pkg=com.xxx cmp=com.xxx/com.appboy.AppboyGcmReceiver (has extras) }\r\n08-25 14:27:37.872 18497-18497/com.xxx E/FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement\r\n08-25 14:27:37.873 18497-18497/com.xxx E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.\r\n08-25 14:27:37.883 18497-18568/com.xxx I/ReactNativeJS: { _alert: 'Click to see Test In-App Message',\r\n                                                                         _data: {},\r\n                                                                         summary: '',\r\n                                                                         message: 'Click to see Test In-App Message',\r\n                                                                         title: 'Appboy Test Send' }\r\n\r\n```"}}
{"actor":{"display_login":"jasonagnew"}}