{"action":"created","issue":{"url":"https://api.github.com/repos/intercom/intercom-android/issues/263","repository_url":"https://api.github.com/repos/intercom/intercom-android","labels_url":"https://api.github.com/repos/intercom/intercom-android/issues/263/labels{/name}","comments_url":"https://api.github.com/repos/intercom/intercom-android/issues/263/comments","events_url":"https://api.github.com/repos/intercom/intercom-android/issues/263/events","html_url":"https://github.com/intercom/intercom-android/issues/263","id":178590975,"number":263,"title":"Crash during SDK initialization in OPPO Smartphones","user":{"login":"jfsso","id":409515,"avatar_url":"https://avatars.githubusercontent.com/u/409515?v=3","gravatar_id":"","url":"https://api.github.com/users/jfsso","html_url":"https://github.com/jfsso","followers_url":"https://api.github.com/users/jfsso/followers","following_url":"https://api.github.com/users/jfsso/following{/other_user}","gists_url":"https://api.github.com/users/jfsso/gists{/gist_id}","starred_url":"https://api.github.com/users/jfsso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfsso/subscriptions","organizations_url":"https://api.github.com/users/jfsso/orgs","repos_url":"https://api.github.com/users/jfsso/repos","events_url":"https://api.github.com/users/jfsso/events{/privacy}","received_events_url":"https://api.github.com/users/jfsso/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-22T12:01:18Z","updated_at":"2016-09-22T12:09:18Z","closed_at":null,"body":"## Version info\r\n  - Intercom for Android version: 3.0.9\r\n  - Android OS version: 4.x & 5.x\r\n  - Android Device: Any OPPO device\r\n\r\n## Expected behavior\r\nSDK initializes without crashing\r\n\r\n## Actual behavior\r\nCrashes during SDK initialization when trying to start IntercomGcmRegistrationService.\r\n\r\nThe service start fails with a SecurityException because of a battery saving setting in OPPO devices. Would be great if the SDK could catch this and fail gracefully.\r\n\r\n## Steps to reproduce\r\n 1. Call Intercom#initialize on an OPPO device\r\n\r\n## Logs\r\n\r\n```\r\nFatal Exception: java.lang.RuntimeException: Unable to create application com.anprosit.drivemode.DriveModeApplication: java.lang.SecurityException: Unable to start service Intent { cmp=com.drivemode.android/io.intercom.android.sdk.gcm.IntercomGcmRegistrationService }: Unable to launch app com.drivemode.android/10133 for service Intent { cmp=com.drivemode.android/io.intercom.android.sdk.gcm.IntercomGcmRegistrationService }: user 0 is restricted\r\n       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4783)\r\n       at android.app.ActivityThread.access$1700(ActivityThread.java:164)\r\n       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1523)\r\n       at android.os.Handler.dispatchMessage(Handler.java:102)\r\n       at android.os.Looper.loop(Looper.java:159)\r\n       at android.app.ActivityThread.main(ActivityThread.java:5541)\r\n       at java.lang.reflect.Method.invoke(Method.java)\r\n       at java.lang.reflect.Method.invoke(Method.java:372)\r\n       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)\r\n       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)\r\nCaused by java.lang.SecurityException: Unable to start service Intent { cmp=com.drivemode.android/io.intercom.android.sdk.gcm.IntercomGcmRegistrationService }: Unable to launch app com.drivemode.android/10133 for service Intent { cmp=com.drivemode.android/io.intercom.android.sdk.gcm.IntercomGcmRegistrationService }: user 0 is restricted\r\n       at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1768)\r\n       at android.app.ContextImpl.startService(ContextImpl.java:1741)\r\n       at android.content.ContextWrapper.startService(ContextWrapper.java:527)\r\n       at io.intercom.android.sdk.IntercomPushManager.startGcmRegistrationService(SourceFile:31)\r\n       at io.intercom.android.sdk.RealIntercom.(SourceFile:94)\r\n       at io.intercom.android.sdk.Intercom.initialize(SourceFile:43)\r\n       at com.anprosit.drivemode.DriveModeApplication.onCreate(SourceFile:183)\r\n```"},"comment":{"url":"https://api.github.com/repos/intercom/intercom-android/issues/comments/248885254","html_url":"https://github.com/intercom/intercom-android/issues/263#issuecomment-248885254","issue_url":"https://api.github.com/repos/intercom/intercom-android/issues/263","id":248885254,"user":{"login":"ronocod","id":466546,"avatar_url":"https://avatars.githubusercontent.com/u/466546?v=3","gravatar_id":"","url":"https://api.github.com/users/ronocod","html_url":"https://github.com/ronocod","followers_url":"https://api.github.com/users/ronocod/followers","following_url":"https://api.github.com/users/ronocod/following{/other_user}","gists_url":"https://api.github.com/users/ronocod/gists{/gist_id}","starred_url":"https://api.github.com/users/ronocod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronocod/subscriptions","organizations_url":"https://api.github.com/users/ronocod/orgs","repos_url":"https://api.github.com/users/ronocod/repos","events_url":"https://api.github.com/users/ronocod/events{/privacy}","received_events_url":"https://api.github.com/users/ronocod/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T12:09:18Z","updated_at":"2016-09-22T12:09:18Z","body":"Thanks for reporting this, we're working on a fix now."}}
{"actor":{"display_login":"ronocod"}}