2

본인의 반응이있는 프로젝트와 Pubnub Javascript SDK-V4를 통합했습니다. 그리고 반응 네이티브 푸시 알림에 https://github.com/zo0r/react-native-push-notification을 사용했습니다. 두 시뮬레이터 모두 (Android 및 iOS) 앱이 백그라운드에서 실행될 때 (앱이 종료 된 경우에도) 알림 배너가 표시됩니다. 그러나 실제 장치에서 테스트 할 때 알림 배너가 표시되지 않습니다. 알림은 알림 바에 만 표시됩니다 (화면 상단에서 스크롤 할 때). 어떠한 제안?Pubnub + React native - iOS 실제 기기에 배너 알림이 없습니다.

다음과 같은 코드 세그먼트가 있습니다.

. 
. 
var PushNotification = require('react-native-push-notification'); 
var serviceCall = require('../../actions/serviceCall'); 
import PushController from '../../actions/pushController' 
var PubNub = require('pubnub'); 
. 
. 

class SearchBar extends Component { 
    constructor(props) { 
     super(props); 
     this.state = { 
      ... 
      ... 

     }; 
     this.constructor.childContextTypes = { 
      theme: React.PropTypes.object, 
     } 

    } 
componentDidMount(){ 

    var pubnub = new PubNub({ 
     publishKey : 'pub-c-xxxxxx', 

     subscribeKey : 'sub-c-xxxxxx' 


     }) 
     var notifyListener ={ 
     message: function(message) { 

      console.warn(JSON.stringify(message)); 
      PushNotification.localNotification({ 

       message: message.message.text, // (required) 

      }); 

     } 
     } 
    pubnub.addListener(notifyListener); 

    pubnub.subscribe({ 
     channels: ['Channel-xxxxxxx'] 
     }); 
    } 

return (
      <Container> 
        <View theme={theme}> 
        <PushController/> 
        . 
        . 
        . 
        </View> 
      </Container> 
     ) 
} 
+0

가 같은 파일에서 전체 코드를 사용하여 코드를 업데이트 할 수 있습니까? –

+0

@CraigConover, 여기에서 당신에게 니스. 코드 세그먼트를 업데이트했습니다. 모든 코드 파일을 여기에 넣을 수 없습니다. 이것은 코드 파일의 흐름이며 이것은 탐색의 첫 페이지입니다. (사용자 로그인 후 기본 페이지). –

+0

안녕하세요 @CraigConover, 모든 업데이트가 필요하십니까? –

답변