Jeepeng / react-native-xinge-push

信鸽推送React Native版,支持华为、小米、魅族官方推送通道
Apache License 2.0
78 stars 29 forks source link

当调用 register 方法时 app 自动退出 #2

Closed stevenxyj closed 7 years ago

stevenxyj commented 7 years ago

当调用 register 方法时 app 自动退出 XGPush.register('jeepeng')

Jeepeng commented 7 years ago

能否提供以下信息: react-native版本:
react-native-xinge-push版本: 报错信息:

stevenxyj commented 7 years ago
"react": "16.0.0-alpha.12",
"react-native": "0.47.1",
"react-native-xinge-push": "^0.2.2"

xinge-push 我已经按照 Remove overriden createJSModules 和 Fixed issue when account = null 做过修改。

不上网时调用 XGPush.register('jeepeng') 不会退出。 联网时调用就会退出,没有错误信息。

Jeepeng commented 7 years ago

react-native 0.47及更高版本应该使用v0.3.0版本 另外确保AndroidManifest.xml里的相应配置换成自己的包名、AccessId和AccessKey 运行以下命令看一下日志(真机需连接数据线): ios: react-native log-ios android: react-native log-android

stevenxyj commented 7 years ago

AccessId和AccessKey 都是对的,也是真机测试 已经升级到 v0.30

AndroidManifest.xml 增加下面的一段就退出了,移队就可以启动。

  <!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
  <!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
  <receiver android:name="com.qq.xgdemo.receiver.MessageReceiver"
      android:exported="true" >
      <intent-filter>
          <!-- 接收消息透传 -->
          <action android:name="com.tencent.android.tpush.action.PUSH_MESSAGE" />
          <!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
          <action android:name="com.tencent.android.tpush.action.FEEDBACK" />
      </intent-filter>
  </receiver>

只需要 中间的 com.qq.xgdemo 改我的 app 包名?还是需要怎么改

Jeepeng commented 7 years ago

改成com.jeepeng.react.xgpush

<receiver android:name="com.jeepeng.react.xgpush.receiver.MessageReceiver"
            android:exported="true" >
            <intent-filter>
                <!-- 接收消息透传 -->
                <action android:name="com.tencent.android.tpush.action.PUSH_MESSAGE" />
                <!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
                <action android:name="com.tencent.android.tpush.action.FEEDBACK" />
            </intent-filter>
        </receiver>
stevenxyj commented 7 years ago

可以了, 建议完善文档,尤其 ios 上的。 增加库, Build Phases->Link Binary With Libraries. libz.tbd CoreTelephony.framework

增加路径 Build Settings->Search Paths->Headers Search Paths. $(SRCROOT)/../node_modules/react-native-xinge-push/ios

Jeepeng commented 7 years ago

好的,谢谢了,有空我去完善一下文档