Closed echokk11 closed 5 years ago
I reslove it myself.
React-native nativeModules can not return things. Only use Callback or Promise
@ReactMethod
public void getChannel(Promise promise) {
promise.resolve(channel);
}
then in js
NativeModules.ChannelModule.getChannel().then(c => {
// got c
})
ChannelModule
,ChannelPackage
add
new ChannelPackage()
toMainApplication
in JavaScript.
const channel = NativeModules.ChannelModule.getChannel();
generateV2ChannelApk , channel = robot , apkChannelName = app-1.0-1-robot-release.apk addIdValueByteBufferMap , new IdValueMap = {-2012129793=java.nio.HeapByteBuffer[pos=0 lim=5 cap=5]} find V2 signature block Id : 1896449818 addIdValueByteBufferMap , existed IdValueMap = {1896449818=java.nio.HeapByteBuffer[pos=0 lim=1545 cap=1545], 1114793335=java.nio.HeapByteBuffer[pos=0 lim=2495 cap=2495]} addIdValueByteBufferMap , final IdValueMap = {1896449818=java.nio.HeapByteBuffer[pos=0 lim=1545 cap=1545], 1114793335=java.nio.HeapByteBuffer[pos=0 lim=2495 cap=2495], -2012129793=java.nio.HeapByteBuffer[pos=0 lim=5 cap=5]} generateApkSigningBlock , needPadding = true generateApkSigningBlock , final length = 4088 padding = 2490 bufferSize = 2478 addIdValueByteBufferMap , oldApkSigningBlock size = 4096 , newApkSigningBlock size = 4096 addIdValueByteBufferMap , after add channel , new apk is /Users/x/ideaprojects/y/android/app/build/channel/release/app-1.0-1-robot-release.apk , length = 12990563 try to read channel info from apk : /Users/x/ideaprojects/y/android/app/build/channel/release/app-1.0-1-robot-release.apk find V2 signature block Id : 1896449818 getByteBufferValueById , destApk /Users/x/ideaprojects/y/android/app/build/channel/release/app-1.0-1-robot-release.apk IdValueMap = {1896449818=java.nio.HeapByteBuffer[pos=0 lim=1545 cap=1545], -2012129793=java.nio.HeapByteBuffer[pos=0 lim=5 cap=5], 1114793335=java.nio.HeapByteBuffer[pos=0 lim=2478 cap=2478]} getByteValueById , id = -2012129793 , value = java.nio.HeapByteBuffer[pos=0 lim=5 cap=5] generateV2ChannelApk , /Users/x/ideaprojects/y/android/app/build/channel/release/app-1.0-1-robot-release.apk add channel success verified : true Verified using v1 scheme (JAR signing): true Verified using v2 scheme (APK Signature Scheme v2): true generateV2ChannelApk , after add channel , apk /Users/x/ideaprojects/y/android/app/build/channel/release/app-1.0-1-robot-release.apk v2 verify success
java -jar VasDolly.jar get -c xxx.apk
could get the channel