<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ilya Eremin on Medium]]></title>
        <description><![CDATA[Stories by Ilya Eremin on Medium]]></description>
        <link>https://medium.com/@IlyaEremin?source=rss-2caa9f9d4fb7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QDhSzOColiTzwDfy.jpg</url>
            <title>Stories by Ilya Eremin on Medium</title>
            <link>https://medium.com/@IlyaEremin?source=rss-2caa9f9d4fb7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:04:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@IlyaEremin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Productivity tips for everyday work]]></title>
            <link>https://medium.com/flatstack-blog/productivity-tips-for-everyday-work-94d8fae2e85c?source=rss-2caa9f9d4fb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/94d8fae2e85c</guid>
            <category><![CDATA[alfred]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[flatstack]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Ilya Eremin]]></dc:creator>
            <pubDate>Wed, 17 Apr 2019 16:29:05 GMT</pubDate>
            <atom:updated>2019-05-16T06:11:29.669Z</atom:updated>
            <content:encoded><![CDATA[<h3>Productivity tips for everyday development</h3><p>Here are some tricks which can be useful for you that I’m using everyday as software engineer. These tricks are applicable for macOS, if you know alternatives for other OSes feel free to leave a comment.</p><h3>alfred</h3><p>It’s a free tool that can cut a lot of your routine. <a href="https://www.alfredapp.com/">You need to install it first</a>. Use ⌥ + space shortcut to open Alfred. These are my most used features:</p><h4>quick app access</h4><p>Open Alfred and start typing app name and hit enter to open this app:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yN7I7d_o2vbIyC9oDNt3Pg.png" /></figure><h4>bookmarks</h4><p>First go to Alfred settings ( ⌥ + space then ⌘ + ,) and enable web bookmarks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qhT5ichTjiQ1RqXlP5zJsA.jpeg" /></figure><p>Open chrome/safari (⌥ + spaceand then type “chrome” or “safari”), find desirable page, add it to bookmark (cmd + d), name and save it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-PzT7OOhXyqUcRPKAS4eRw.png" /></figure><p>Wait for ~10 seconds (yeah that’s strange, but this time is necessary to make a bookmark available via Alfred). Open Alfred and start typing bookmark name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QvgF4CEp1SEkLpLF4pHgOg.png" /></figure><p>I put urls which I use at least couple times a week in bookmarks.</p><h4>commands</h4><p>⌥ + space and type:</p><p><strong>Sleep</strong> — to sleep OS. I’m using an external monitor so just closing my laptop is not enough.</p><p><strong>Restart</strong> — restart OS.</p><p><strong>Lock</strong> — well, my colleagues love to send stupid messages from me to corporate messenger. It’s best to lock my computer. And unlike sleep it’s much faster to start working from a locked state.</p><h4>other</h4><p>There are a lot of things. You can do basic math, use it as Google shortcut (just type anything and press enter) and so on. I find them fascinating but rarely use those ones.</p><h3>personal/work accounts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QiYzfjut5Fad2XF-zGTXlQ.png" /></figure><p>Here is my motivation:</p><ol><li>Continue from the same place. You logout from an account and when login back you are on the same state. Same tabs, same apps opened.</li><li>Separate work and personal emails/services/apps. This is a huge distraction (social network on works, work stuff on weekends) and pain point (just remember trying to login to Google services using the RIGHT email ha-ha).</li></ol><p>Also I do same on my Android phone, but not very successfully.</p><p>One caveat here. You probably will experience permission issues for apps that you use across accounts. I personally had issues with brew, ohmyzsh, Android Studio. Google will help you and most likely simple chmod ‘ing will be enough.</p><h3>shortcuts</h3><p>When I start using a new app/web service, I’m at least trying to learn shortcuts for the most important operations. I highly recommend to learn at least shortcuts for your IDE, browser and OS of choice.</p><p><a href="https://medium.com/@gotoark/most-useful-shortcut-keys-for-android-studio-with-bonus-plugins-bf95c85427f0">Android Studio</a> , <a href="http://osxdaily.com/2012/04/03/safari-keyboard-shortcuts/">Safari</a> shortcuts</p><h3>summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*M975L4Ct1uRn2Y51LqJmwA.jpeg" /></figure><p>Now you can cut some mental overhead and do whatever you want with saved energy.</p><p>Feel free to share your tips.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94d8fae2e85c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flatstack-blog/productivity-tips-for-everyday-work-94d8fae2e85c">Productivity tips for everyday work</a> was originally published in <a href="https://medium.com/flatstack-blog">Flatstack Thoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrate to API 26: Push notifications with custom sound/vibration/light]]></title>
            <link>https://medium.com/flatstack-blog/migrate-to-api-26-push-notifications-with-custom-sound-vibration-light-14846ebc9e96?source=rss-2caa9f9d4fb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/14846ebc9e96</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[api26]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[push-notification]]></category>
            <dc:creator><![CDATA[Ilya Eremin]]></dc:creator>
            <pubDate>Sat, 24 Nov 2018 20:52:29 GMT</pubDate>
            <atom:updated>2019-12-15T15:59:43.728Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m5Ra3QV_wSg9vWzB2mTIuw.png" /></figure><p>“Oh why” you think. Google already has <a href="https://developer.android.com/training/notify-user/channels">docs</a> on this topic.</p><p>Recently I migrated to latest target sdk to <a href="https://developer.android.com/distribute/best-practices/develop/target-sdk">meet Google Play API requirements</a> and discovered that Google docs are incomplete and give you bad examples.</p><p>I’m going to provide you with missing pieces.</p><h4>this guide can be useful for</h4><p>Developers who have apps with custom notification sound, custom light and/or custom vibration pattern. If yours do not then just add notification channel(s) to your app and you are good.</p><h3>baseline</h3><h4>Server Side</h4><p>In order to send push notification your server sends POST request to <a href="https://fcm.googleapis.com/fcm/send">https://fcm.googleapis.com/fcm/send</a> with following body:</p><pre>{<br>  &quot;token&quot;: &quot;client_notification_token&quot;, &lt;- or topic<br>  &quot;notification&quot;: {<br>    &quot;title&quot;: &quot;Push notification title&quot;,<br>    &quot;body&quot;: &quot;Push body&quot;,<br>    &quot;sound&quot;: &quot;filename&quot;, &lt;-- points to src/res/raw/filename.mp3<br>  }<br>  ...<br>}</pre><h4>Client Side</h4><p>In order to receive push notifications your app has a class which extends FirebaseMessagingService with onMessageReceived method overridden.</p><pre>class PushNotificationListener extends FirebaseMessagingService {<br>  <br>  final int <strong>NOTIFICATION_COLOR</strong> = context.getResources().getColor(R.color.colorPrimary);<br>  final Uri <strong>NOTIFICATION_SOUND_URI</strong> = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + &quot;://&quot; + BuildConfig.APPLICATION_ID + &quot;/&quot; + R.raw.telegraph);     <br>  final long[] <strong>VIBRATE_PATTERN</strong>    = {0, 500};    <br>  <br>  @Override public void onMessageReceived(RemoteMessage msg) {<br>    Notification ntf = new NotificationCompat.Builder(context)<br>      .setSmallIcon(R.drawable.notification_icon)<br>      .setContentTitle(title)            <br>      .setStyle(new NotificationCompat.BigTextStyle().bigText(body))<br><strong>      .setColor(NOTIFICATION_COLOR)<br>      .setSound(NOTIFICATION_SOUND_URI)<br>      .setVibrate(VIBRATE_PATTERN)</strong><br>      .setContentIntent(pendingIntent)<br>      .build();<br>    <br>    [...]<br>    <br>    notificationManager.notify(ntf);<br>  }<br>}</pre><p>When app receives push-notification user sees lovely notification like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*pAig4dsrZXYu8R2Y7E21Dw.png" /></figure><p>And user hears sound and feels vibration.</p><h3>after you set <strong>targetSdkVersion &gt;</strong>= 26</h3><p>Notifications stop working.</p><p>Let’s return them back to life.</p><h4>Register notification channel</h4><p>Notification channel has same settings as notification does: sound, vibration pattern and light. Register channel with desirable settings:</p><pre>@SuppressLint(&quot;NewApi&quot;)    <br>public  void createNotificationChannel(@NonNull Context context) {<br> if (<strong>AndroidVersion.getInstance().deviceSDK() &gt;= Build.VERSION_CODES.O</strong>) {<br>  String channelId = context.getString(R.string.channel_id);<br>  String channelName = context.getString(R.string.channel_name);<br>  NotificationChannel channel = new NotificationChannel(channelId, channelName);<br>  <strong>channel.setSound</strong>(<strong>NOTIFICATION_SOUND_URI</strong>, createAudioAttributes());<br>  <strong>channel.setLightColor</strong>(<strong>NOTIFICATION_COLOR</strong>);<br>  <strong>channel.setVibrationPattern</strong>(<strong>VIBRATE_PATTERN</strong>);<br>  <strong>channel.enableVibration</strong>(<strong>true</strong>);<br>  NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);<br>  <strong>notificationManager.createNotificationChannel</strong>(channel);        <br> }    <br>}</pre><p><strong>Until you register notification channel your app notifications are going to have default behaviour</strong>. So register it as early as you can. I put this code in Application.onCreate.</p><p>Keep in mind: once you register channel you cannot change its behaviour. You have to remove app and then install it again to apply new behaviour.</p><h3>specify notification channel</h3><p>You have to do it in 2 places: for foreground (app is alive) and background (app is not running, i.e. killed by user, not started after reboot) notifications.</p><h4>foreground notifications</h4><p>Instead of</p><pre>Notification ntf = new NotificationCompat.Builder(ctx );</pre><p>use</p><pre>Notification ntf = new NotificationCompat.Builder(ctx, <strong>channelId);</strong></pre><h4>background notifications</h4><p>You can do it in 2 ways:</p><ul><li>by changing server side: add android_channel_id inside notification block</li></ul><pre>{<br>  &quot;token&quot;: &quot;client_notification_token&quot;, &lt;- or topic<br>  &quot;notification&quot;: {<br>    &quot;title&quot;: &quot;Push notification title&quot;,<br>    &quot;body&quot;: &quot;Push body&quot;,<br>    &quot;sound&quot;: &quot;filename&quot;,<br><strong>    &quot;android_channel_id&quot;: &quot;your_channel_name&quot;<br></strong>  }<br>  ...<br>}</pre><ul><li>by changing client side: set default channel id in AndroidManifest.xml</li></ul><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>  &lt;application&gt;<br>  [...]</pre><pre> <strong>   &lt;meta-data android:name=<br>     &quot;com.google.firebase.messaging.default_notification_channel_id&quot;<br>      android:value=&quot;@string/default_notification_channel_id&quot; <br>      /&gt;</strong></pre><pre><strong>  </strong>[...]<br>  &lt;/application&gt;<br>&lt;/manifest&gt;</pre><p>If you app has only 1 notification channel and there is no plans to add more channels then pick second option.</p><p>This is pretty much it.</p><h4>warning</h4><p>When the app receives a push notification before a channel is registered, the user is going to experience default notification behavior. Such case may happen if the user installed/updates the app but does not run it after. I personally decided to do nothing about it.</p><p>Thanks for reading. Talk to you soon ❤️🖤.</p><h4>links</h4><p><a href="https://stackoverflow.com/questions/45395669/notifications-fail-to-display-in-android-oreo-api-26">SO link which helped me figure out channels behaviour</a><br><a href="https://firebase.google.com/docs/cloud-messaging/android/client">Googles’ article how to setup Android client to receive push notification </a><br><a href="https://developer.android.com/training/notify-user/channels">Googles’ article on notification channels</a><br><a href="https://firebase.google.com/docs/cloud-messaging/http-server-ref">List of all possibles params you can send to firebase</a><br>Firebase has a console. You can send test push notifications from it: https://console.firebase.google.com/project/<strong>{your_app_name}</strong>/notification/compose</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14846ebc9e96" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flatstack-blog/migrate-to-api-26-push-notifications-with-custom-sound-vibration-light-14846ebc9e96">Migrate to API 26: Push notifications with custom sound/vibration/light</a> was originally published in <a href="https://medium.com/flatstack-blog">Flatstack Thoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Increase version code and version name on Android using Gradle script]]></title>
            <link>https://medium.com/@IlyaEremin/npm-version-for-gradle-android-9137a7dc273c?source=rss-2caa9f9d4fb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9137a7dc273c</guid>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[versioning]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[semver]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ilya Eremin]]></dc:creator>
            <pubDate>Mon, 18 Sep 2017 21:14:53 GMT</pubDate>
            <atom:updated>2018-09-28T18:47:33.972Z</atom:updated>
            <content:encoded><![CDATA[<h3>intro</h3><p>In JS world there is nice package manager called npm. It has nice command:</p><pre>npm version [patch|minor|major]</pre><p>After I tried it I immediately wanted same tool for Android.</p><h3>what the hell npm version does</h3><p>It increases your app version. For example, your app version is 1.0.0. Following table shows how command affect on version number:</p><pre>npm version patch        -&gt;   1.0.1</pre><pre>npm version minor        -&gt;   1.1.0</pre><pre>npm version major        -&gt;   2.0.0</pre><p>This command internally makes 3 things:</p><ol><li>Changes app version inside <em>package.json </em>file.</li><li>Creates commit of changes from step 1.</li><li>Creates git tag.</li></ol><p>Welcome, same versioning tool for Android: <strong>bumper</strong></p><h3>prerequirements</h3><ul><li>git as source control system</li><li>use <a href="https://gitversion.readthedocs.io/en/latest/reference/intro-to-semver/">semantic version</a> for version name (tl;dr; — should match x.y.z pattern). <a href="https://medium.com/@maxirosson/versioning-android-apps-d6ec171cfd82">Good article about Android Versioning</a>.</li></ul><h3>setup</h3><ol><li>Add on top of app/build.gradle:</li></ol><pre>apply <strong>from</strong>: <strong>&#39;</strong><a href="https://gist.githubusercontent.com/IlyaEremin/8821fbf0069e8e60dfeaeefc19afaca2/raw/ce54be4ea6f19b9609f303cd75714d6ec8d916e5/app_version.gradle">https://gist.githubusercontent.com/IlyaEremin/8821fbf0069e8e60dfeaeefc19afaca2/raw/ce54be4ea6f19b9609f303cd75714d6ec8d916e5/app_version.gradle</a><strong>&#39;</strong></pre><p><a href="https://gist.github.com/IlyaEremin/8821fbf0069e8e60dfeaeefc19afaca2">Sources of script</a></p><p>2. Run</p><pre>./gradlew bumperInit -PbumperVersionName=1.0.0 -PbumperVersionCode=1</pre><p>It creates file app/gradle.properties with following content:</p><pre>appVersionName=1.0.0<br>appVersionCode=1</pre><p>If such file exists then adds values to the end of file.</p><p>3. Inside app/build.gradle change</p><pre>android {<br>  ...<br>  defaultConfig {<br>    versionCode 1<br>    versionName 1.0.0<br>    ...<br>  }<br>}</pre><p>to</p><pre>android {<br> ...<br> defaultConfig {<br>    versionCode appVersionCode.toInteger()<br>    versionName appVersionName<br>    ...<br>  }<br>}</pre><h3>how to use</h3><ol><li>Run</li></ol><p>./gradlew bumperVersionPatch</p><ul><li>version code of your app has been increased by 1</li><li>last number (patch) of version name has been increased (1.0.0 -&gt; 1.0.1)</li><li>new commit with message “Release 1.0.1” has been created</li><li>new tag with name “v1.0.1” has been created</li></ul><p>There are 2 more commands:</p><pre>./gradlew bumperVersionMinor</pre><pre>./gradlew bumperVersionMajor</pre><p>to increase minor and major number accordingly.</p><p>Thank you for reading, hope it’s useful. Please leave comments with your suggestions. I’m very new in gradle plugin world!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9137a7dc273c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Modify API response for Android app using Charles proxy]]></title>
            <link>https://medium.com/flatstack-blog/modify-api-response-for-android-app-with-charles-181a822cfc24?source=rss-2caa9f9d4fb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/181a822cfc24</guid>
            <category><![CDATA[https]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[flatstack]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[charle]]></category>
            <dc:creator><![CDATA[Ilya Eremin]]></dc:creator>
            <pubDate>Mon, 03 Apr 2017 15:30:51 GMT</pubDate>
            <atom:updated>2018-12-09T07:39:42.117Z</atom:updated>
            <content:encoded><![CDATA[<h3>why</h3><p>For example, your application on start asks your server “hey, budy, am I outdated? What’s the latest version of myself?”, i.e. app sends GET request. Server responds with following:</p><pre>{<br>    &quot;app_version&quot;: 19,<br>    &quot;link&quot;: &quot;https://link.to/download/your_app_v19.apk&quot;<br>}</pre><p>If user has non latest app version then app downloads latest version and offers user to update. Let’s call this feature ‘autoupdater’.</p><p>You are preparing new release. You should make full regression tests on exact apk you are going to upload on Google Play i.e. it points to prod environment. You have to verify autoupdater too.</p><p>You can’t change server response because it triggers current production users autoupdater.</p><h3>how</h3><p>Proxy. In particular — <a href="https://www.charlesproxy.com/">Charles</a>. Below instruction is for 4.0.2 MacOS version.</p><h4>prerequiriments</h4><p>Your phone and your computer should be connected to the <strong>same Wi-Fi network</strong>.</p><h4>on your mac</h4><ol><li>Download, install and launch <a href="https://www.charlesproxy.com/download/">Charles</a>.</li><li>Top bar menu -&gt; Proxy -&gt; Proxy Settings</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*_bvMWVxnpehbxzOKuY9aDw.png" /></figure><p>3. In proxies tab check “Enable transparent HTTP proxying”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*QI5KZMJarJZZnIdKKMsJMg.png" /></figure><p>4. Top bar -&gt; Proxy -&gt; SSL Proxying Settings… -&gt; SSL Proxying</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*_v36CrRDJBAM_0C9ieXFMg.png" /></figure><p>4.1. Check “Enable SSL Proxying”<br>4.2. Click Add<br>4.3. Enter your domain without http/https, for example: <em>your-domain.com</em><br>4.4. Ok — OK</p><p>5. Cmd+Alt+R to open rewriter tool</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*TG3ePJp03hzCl8waL4Y5FA.png" /></figure><p>5.1. Check “Enable rewriter”<br>5.2. Click “Add”<br>5.3. On the right half of the window type request modifier name<br>5.4. Click first “Add” button. Thus you will add requests filter which you want to rewrite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*9Xn_sFnnj9k_zvq5Om3Aug.png" /></figure><p>5.5. Protocol -&gt; http/https, host -&gt; your-domain.com, Path -&gt; v1/app_info</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*d7s2ZyNrI_VsuJooVGsrTg.png" /></figure><p>5.6. Click second “Add”. Thus you point how you want to change request (request itself or response or both).<br>5.7. Type -&gt;Body, Replace -&gt; Value -&gt;</p><pre>{<br>    &quot;app_version&quot;: 20,<br>    &quot;link&quot;: &quot;https://link.to/download/your_app_v20.apk<br>}</pre><p>I increased app_version to 20 to trigger autoupdater.</p><p>You can rewrite body, headers, status, url — every aspect of the query and its answer.</p><p><strong>Before setup Android phone do next:</strong></p><p>Connect to Wi-Fi network and press alt and left click on wi-fi networks icon on system panel. Remember “IP Address” section. For me it’s <strong>192.168.1.121</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*SNYazr9qgW5lh50U6-P1RQ.png" /></figure><h4>On your Android phone.</h4><ol><li>Connect to the same Wi-Fi network as your Mac does.</li><li>Long press on connected network -&gt; Modify Network. In proxy hostname enter IP Address you previously wrote (192.168.1.121 for me), proxy port is 8888. If <strong>you use genimotion</strong> then use 10.0.3.2 proxy hostname instead.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*BGTqFL_uzDfR71OplPGY0A.jpeg" /></figure><p>3. Open <a href="http://www.charlesproxy.com/getssl/">http://www.charlesproxy.com/getssl</a> from your phone to download SSL certificate, downloading begins automatically. Then click on downloaded file to install it. Important, you have to set pin/pattern or any other lock screen security to be able to install SSL certificate.</p><blockquote>When using user trusted certificates, Android will force the user of the Android device to implement additional safety measures: the use of a PIN-code, a pattern-lock or a password to unlock the device are mandatory when user-supplied certificates are used.</blockquote><h3>let’s verify</h3><p>I tried to modify <em>your-domain.com/v1/app_info </em>endpoint but it does not work. Charles can’t rewrite requests to nonexistent server (try open <a href="http://your-domain.com/">your-domain.com</a> ;)). So I used different domain. The only requirement is domain should be accessible (if <em>your-domain.com</em> accessible then it does not matter is <em>your-domain.com/v1/app_info </em>endpoint exist or not).</p><p>If I open your-domain.com/v1/app_info in browser then I get following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*uqpE98DyM4dZ4r3nh2SfOw.png" /></figure><p>Charles shows me following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y-vmoXt6QYUXTZeYLWCisg.png" /></figure><p>Request has been successfully modified.</p><p>Happy response modifying.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=181a822cfc24" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flatstack-blog/modify-api-response-for-android-app-with-charles-181a822cfc24">Modify API response for Android app using Charles proxy</a> was originally published in <a href="https://medium.com/flatstack-blog">Flatstack Thoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android JSON Parsers Comparison]]></title>
            <link>https://medium.com/@IlyaEremin/android-json-parsers-comparison-2017-8b5221721e31?source=rss-2caa9f9d4fb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b5221721e31</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[parser]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Ilya Eremin]]></dc:creator>
            <pubDate>Sun, 05 Mar 2017 16:52:39 GMT</pubDate>
            <atom:updated>2018-05-19T07:17:13.443Z</atom:updated>
            <content:encoded><![CDATA[<p>There are bunch of json parsers. Recently I discovered <a href="https://github.com/afollestad/ason">ason</a>. Also I heard about <a href="https://github.com/square/moshi">moshi</a> but not used it. So I wanted to compare them.</p><p>List of parsers to compare: <a href="https://github.com/google/gson">gson</a> 2.8.0, <a href="https://github.com/FasterXML/jackson">jackson</a> 2.0.1, <a href="https://github.com/square/moshi">moshi</a> 1.4.0, <a href="https://github.com/afollestad/ason">ason</a> 1.1.0.</p><p>I found one worthy related <a href="http://blog.takipi.com/the-ultimate-json-library-json-simple-vs-gson-vs-jackson-vs-json/">article</a> from 2015. It’s compares old versions of gson and jackson and it does not cover moshi and ason.</p><h3>how I am going to test</h3><p>I experimented on parsing <a href="https://github.com/IlyaEremin/JsonParsersComparation/blob/master/app/src/main/res/raw/small.json">small</a> (6kb) and <a href="https://github.com/IlyaEremin/JsonParsersComparation/blob/master/app/src/main/res/raw/big.json">big</a> (973kb, <strong>slow page!</strong>) jsons.</p><p>Small JSON consists of list of <a href="https://github.com/IlyaEremin/JsonParsersComparation/blob/master/app/src/main/java/com/ilyaeremin/jsonparserscomparation/models/SmallObject.java">small objects</a>. Small object consists of 4 simple fields and one list.</p><p>Big JSON consists of list of <a href="https://github.com/IlyaEremin/JsonParsersComparation/blob/master/app/src/main/java/com/ilyaeremin/jsonparserscomparation/models/Human.java">big objects</a>. Big object consists of 19 simple fields and four lists.</p><p>I recorded 2 parameters: parsing time and number of GC calls while parsing. Less is better for both.</p><p>To track GC calls I used my friends’ <a href="https://github.com/arychagov/GC-Airhorn/blob/master/app/src/main/java/gc/airhorn/GcAirHorn.java">GC calls tracker</a>.</p><h4>testing methodology</h4><ol><li>Open app.</li><li>Run parsing (for example small JSON with gson) 4 times.</li><li>Throw away first result.</li><li>Find average value for 2–4 runs.</li><li>Close app and remove app from recent list.</li></ol><h3>methods / fields count</h3><p>It’s worth to mention, due to <a href="https://developer.android.com/studio/build/multidex.html">65k limit</a>:</p><pre>        | methods count | fields count<br>-------------------------------------     <br>gson    | 1030          | 405<br>moshi   | 535           | 238<br>jackson | 6724          | 1756<br><strong>ason    | 89            </strong>|<strong> 6 </strong></pre><h3>small json parsing</h3><p>Let’s <a href="https://github.com/IlyaEremin/JsonParsersComparation/blob/master/app/src/main/java/com/ilyaeremin/jsonparserscomparation/ParseNTimesSmallJson.java">parse small JSON</a> on 4.4 emulator:</p><pre>4.4.2   | time / gc<br>-------------------<br>gson    | 1124 / 76 <br><strong>jackson | 840  / 36</strong><br>moshi   | 2198 / 38<br>ason    | 3343 / 193</pre><p>6.0.1 real device (lenovo vibe x3):</p><pre>6.0.1   | time / gc<br>--------------------<br>gson    | 1024 / 3<br><strong>jackson | 913  / 1</strong><br>moshi   | 2092 / 2<br>ason    | 6225 / 14</pre><h3>big JSON parsing</h3><p><a href="https://github.com/IlyaEremin/JsonParsersComparation/blob/master/app/src/main/java/com/ilyaeremin/jsonparserscomparation/ParseNTimesBigJsonActivity.java">Parsing big JSON</a> on 4.4.2 emulator:</p><pre>4.4.2   | time / gc<br>--------------------<br>gson    | 1837 / 63<br><strong>jackson | 1536 / 41</strong><br>moshi   | 2978 / 87<br>ason    | 1745 / 88</pre><p>6.0.1 real device (lenovo vibe x3):</p><pre>6.0.1   | time / gc<br>--------------------<br>gson    | 1988 / 5<br>jackson <strong>| </strong>1902 / <strong>4</strong><br>moshi   | 4611 / 9<br><strong>ason    | 1373 / 4</strong></pre><p>Let’s stop here. Ason is far more better than jackson. Moshi shows worst result. I also tried 5.1 emulator and another 6.0 emulator and get similar time ratio. 7.0 emulator gets me another picture:</p><pre>7.0     | time / gc<br>--------------------<br>gson    | 505  / 9<br><strong>jackson | 327  / 6</strong><br>moshi   | 692  / 13<br>ason    |<strong> </strong>862  / 17</pre><p>So ason performance varies between platforms, from fastest to slowest.</p><h3>conclusion</h3><p><strong>jackson</strong>:<br>pros: fasters, triggers GC least, most customazible <br>cons: 6.7k methods (can be reduced by Proguard), API not so friendly</p><p><strong>gson</strong>:<br>pros: fast enough, most popular (10k stars on github), pretty API, small<br>cons: relatively slow, trigger GC relatively more</p><p>There is no reasons for me to use moshi or ason based on this comparation: they are slower almost in each test.</p><h3>Links</h3><p><a href="https://github.com/IlyaEremin/JsonParsersComparation">Sources on Github</a><br><a href="https://github.com/IlyaEremin/JsonParsersComparation/blob/master/json_comparation.apk">Apk to play with</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b5221721e31" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>