onMessage did not triggering in release apk but worked in debug mode
See original GitHub issueWhen Its is in debug mode OnMessage function triggered but when I build the Apk file it does not triggered
onWebviewLoaded = () => { if(this.props.storeName) { let storeName = this.props.storeName.toLowerCase(); storeName = storeName.replace(/ +/g, “”); console.log("storeName: ", storeName);
let storeAttribute = this.props.scrapingAttributes[storeName];
console.log("storeAttribute: ", storeAttribute);
let jsCode = `
${getMultipleInfoFromXpath}
${trimString}
${getValueByRegEx}
${removeByRegEx}
let attributes = ${JSON.stringify(storeAttribute)};
let data = {};
for(let i in attributes){
data[i] = getMultipleInfoFromXpath(attributes[i])
}
window.ReactNativeWebView.postMessage(JSON.stringify(data))
`;
this.setState({
loaded: true,
jsCode
})
}
};
onMessage = (data) => {
let {productBrand, productImage, productName, productNewPrice ,productColor, productSize} = JSON.parse(data) ;
this.setState({
webInfo: JSON.parse(data),
brand: productBrand[0],
imageUrl:productImage[0],
name: productName[0],
newPrice: productNewPrice[0],
productColor,
productSize
});
Alert.alert(
'onMessage',
'My Alert Msg',
[
{text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
{
text: 'Cancel',
onPress: () => console.log('Cancel Pressed'),
style: 'cancel',
},
{text: 'OK', onPress: () => console.log('OK Pressed')},
],
{cancelable: false},
);
};
<WebView ref={r => this.webview = r} source={{uri: url}} renderLoading={this.renderLoading} startInLoadingState={true} onLoadEnd={this.onWebviewLoaded} onNavigationStateChange={(webViewState)=>{this.setState({ trackedUrl: webViewState.url, brand: ‘’, imageUrl:‘’, name: ‘’, newPrice: ‘’, productColor:[], productSize:[] })}} injectedJavaScript={loaded ? jsCode : null} onMessage = {(e) => {this.onMessage(e.nativeEvent.data)}} javaScriptEnabled={true} />
Issue Analytics
- State:
- Created 4 years ago
- Comments:22
Top Results From Across the Web
onMessage did not triggering in release apk but worked in ...
When Its is in debug mode OnMessage function triggered but when I build the Apk file it does not triggered. onWebviewLoaded = ()...
Read more >java - Android Studio - Stack Overflow
MessageClient.OnMessageReceivedListener not called in release mode, but working fine in debug mode - Android Studio · Ask Question. Asked 2 ...
Read more >Firebase Cloud Messaging not working on Release mode (FCM)
I'm using the FCM for push notifications. Its perfectly working in Debug mode but not working in Release after I signed with KeyStore....
Read more >Receive messages in a Flutter app - Firebase - Google
On iOS, if the user swipes away the application from the app switcher, it must be manually reopened for background messages to start...
Read more >Debug an Android device that is not receiving mobile app ...
Debug an Android device that is not receiving mobile app messages ; loglevel, This parameter indicates to the SDK how much logging information ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have the same problem with you, Android debug and iOS are all running smoothly. only android release is never called onMessage. any solution?
@expouic Is there any console.log which is printing event of onMessage callback if yes, then please strip it out.