Posts

Report your AdMob earnings via Only One Single XMLHttpRequest

Image
Send XMLHttpRequest function reqListener () { console.log(this.responseText); } function admobReport() { var url = 'https://content.googleapis.com/adsense/v1.4/accounts/'; var accountId = 'pub-xxx'; // change to your own accountId url += accountId; url += '/reports?dimension=APP_ID'; url += '&filter=AD_CLIENT_ID==ca-app-' + accountId; url += '&metric=EARNINGS' url += '&startDate=2018-02-01'; // change start date url += '&endDate=2018-02-24'; // change end date var oReq = new XMLHttpRequest(); oReq.addEventListener("load", reqListener); oReq.open("GET", url); var AuthorizationToken = 'xxx'; // The way to get it is in this post oReq.setRequestHeader('Authorization', 'AuthorizationToken'); oReq.send(); } admobReport(); Response { "kind": "adsense#report", "totalMatchedRows": "1", "headers": [ { "name&

Westminster Shorter Catechism Q&A, my first android app

Image
Download here. react-native project https://github.com/lengerrong/WestminsterShorterCatechismQA Can't release for iOS yet, since I do not have a mac laptop yet.

Privacy Policy

Your privacy is critically important to us. At errong.win, we do not collect and transmit any user data.

MessageLoop in Cobalt/Chromium

Image

react-native : multi language support set up, use device locale, react-native-i18n use example

Image
Multi language prepare .\app\i18n\locales\en.js export default { wcsqa: 'Westminster Shorter Catechism Q&A' }; .\app\i18n\locales\zh.js export default { wcsqa: '威斯敏斯德小要理问答' }; .\app\i18n\i18n.js import I18n from 'react-native-i18n'; import en from './locales/en'; import zh from './locales/zh'; I18n.fallbacks = true; I18n.translations = { en, zh }; export default I18n; Usage App.js import ReactNativeLanguages from 'react-native-languages'; import I18n from './app/i18n/i18n' ReactNativeLanguages.addEventListener('change', ({ language }) => { I18n.locale = language; }); render() { return ( <View style={styles.container}> <View style={styles.header}> <Text style={styles.title}> {I18n.t('wcsqa')} </Text> ... // other contents </View> ... // other contents </View> ) }

react-native : header bar(title + option button) example

Image
Render render() { return ( <View style={styles.container}> <View style={styles.header}> <Text style={styles.title}> {I18n.t('wcsqa')} // your title </Text> <TouchableOpacity onPress={() => {}}> <Image style={styles.option} source={require('./res/img/nav_icon.png')} /> </TouchableOpacity> </View> <View style={styles.content}> <Text> {this.wcs[0].Q} // your content </Text> </View> </View> ) } Style const styles = StyleSheet.create({ container: { flex: 2, }, header: { backgroundColor: '#00FF7F', flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', }, title: {

language code for Chinese should be start with 'zh'

According to RFC4646 ( http://www.ietf.org/rfc/rfc4646.txt ) language codes for Traditional Chinese should be zh-Hant react-native-i18n import { getLanguages } from 'react-native-i18n' getLanguages().then(languages => { console.log(languages); }); Set system language to Chinese 01-24 17:47:47.957 19851 19873 I ReactNativeJS: [ 'zh-Hans-CN', 'en-US' ] Set system language to English 01-24 17:56:30.754 20563 20584 I ReactNativeJS: [ 'en-US', 'zh-Hans-CN' ]