<?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 Chetan Ashtivkar on Medium]]></title>
        <description><![CDATA[Stories by Chetan Ashtivkar on Medium]]></description>
        <link>https://medium.com/@chetan.ashtivkar?source=rss-4661de45b8fb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TessgnpdWBECGJxS.</url>
            <title>Stories by Chetan Ashtivkar on Medium</title>
            <link>https://medium.com/@chetan.ashtivkar?source=rss-4661de45b8fb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 00:24:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chetan.ashtivkar/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[Jhanda uncha rahe hamara]]></title>
            <link>https://medium.com/@chetan.ashtivkar/jhanda-uncha-rahe-hamara-2f61f48bca3f?source=rss-4661de45b8fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f61f48bca3f</guid>
            <category><![CDATA[india]]></category>
            <category><![CDATA[respect]]></category>
            <category><![CDATA[patriotism]]></category>
            <category><![CDATA[independence-day]]></category>
            <category><![CDATA[flags]]></category>
            <dc:creator><![CDATA[Chetan Ashtivkar]]></dc:creator>
            <pubDate>Sun, 13 Aug 2017 16:59:56 GMT</pubDate>
            <atom:updated>2019-08-14T05:00:55.040Z</atom:updated>
            <content:encoded><![CDATA[<p>When I was a kid I had a hobby of collecting old currency coins. By the time I was 14 years old I had about 70 coins in my collection, and I was very proud of it. I still remember how excited I was when I was about to get my 50th coin. But as I grew up I broke up with it and gave away all the coins I collected to one of my younger cousins. I really thought that such hobbies are for kids and not for the grown ups.</p><p>But since last three years I have been collecting something. I have 48 of them in 63 pieces till now. But unlike my coins’ collection I am not at all proud of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z7ZT_PL_gegzgR93k8QeKg.jpeg" /></figure><p>Our <em>Tiranga</em> symbolizes our nation as a whole entity. It also symbolizes the struggle of all the individuals who gave away their lives to achieve the independence.</p><blockquote>The least thing we can do is to respect it.</blockquote><p>For the last few days there’s a fuss about banning Chinese items. Just for the record, most of the Indian flags we see in the market are made in China.</p><p>I think few of you might have already bought the flags by now for the Independence Day, but for those who haven’t, just consider what you are going to do with it on the evening of the Independence Day? It doesn’t make you less patriotic if you are not carrying a flag on the Independence day or Republic Day.</p><p>And if you must buy it, then there are certain ways in which one can dispose of a torn flag respectfully. I need to do it very badly.</p><p>I just hope that I won’t ever get my 50th flag. Wish you all a very happy Independence Day.</p><p>PS : <a href="https://www.freepressjournal.in/cmcm/how-to-dispose-of-damaged-indian-national-flag-with-dignity">Follow this link to see the ways to dispose of a torn flag respectfully.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f61f48bca3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Merging multiple android notifications.]]></title>
            <link>https://medium.com/hopbucket/merge-firebase-notifications-9f96de7d026a?source=rss-4661de45b8fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f96de7d026a</guid>
            <category><![CDATA[push-notification]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[firebasecloudmessaging]]></category>
            <category><![CDATA[sharedpreferences]]></category>
            <dc:creator><![CDATA[Chetan Ashtivkar]]></dc:creator>
            <pubDate>Sat, 07 Jan 2017 09:52:22 GMT</pubDate>
            <atom:updated>2018-02-02T15:01:21.960Z</atom:updated>
            <content:encoded><![CDATA[<p>My name is Chetan Ashtivkar, I am a software engineer at <a href="http://hopbucket.com/">HopBucket.</a> HopBucket is a platform which helps you plan the perfect trip. You can use your friend’s ideas or you can take help of other travelers who have been to that particular place.</p><p>In our app we use firebase notifications to notify our users about the activities on HopBucket, which includes new likes or comments on their trips, new friend joining HopBucket, featured trips etc. We had already setup all the necessary infrastructure for sending notification from cloud and had implemented the <a href="https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/FirebaseMessagingService">FirebaseMessagingService </a>in our app.</p><p>When we push a notification from the cloud it shows up in the notification drawer. Everything is great up to this point. But when the app receives another notification — while the previous notification is still in the notification drawer — it replaces the last notification. This is clearly not desirable.</p><p>If there is a single notification in the notification drawer then clicking on it should perform the desired action. On the other hand, if there are multiple notifications, they should simply open the notification center in the HopBucket app where all the past notifications are shown.</p><p>I asked <a href="http://stackoverflow.com/questions/40577257/how-to-merge-push-notifications-in-firebasemessagingservice">this question on stackoverflow</a>, but did not get any answers. So after some brainstorming we came up with a solution.</p><p>To achieve the desired behavior, we used <a href="https://developer.android.com/reference/android/content/SharedPreferences.html">SharedPreferences </a>. The SharedPreferences class is used to save key-value pair data. We are using <a href="https://developer.android.com/reference/android/app/Notification.InboxStyle.html">InboxStyle Notification</a>s for merging notifications. There might be better ways to do it and if you come across any of it then please comment down below or post your answers/ suggestions/ queries <a href="http://stackoverflow.com/questions/40577257/how-to-merge-push-notifications-in-firebasemessagingservice">here</a></p><p>The complete code we wrote is as follows:</p><pre>public class MyFirebaseMessagingService  extends FirebaseMessagingService {</pre><pre>private static final String TAG = &quot;MyFirebaseMsgService&quot;;<br>    private static final String actionLiked = &quot;liked&quot;;<br>    private static final int NOTIFICATION_ID = 1593;<br>    private final String GROUP_KEY = &quot;GROUP_KEY_RANDOM_NAME&quot;;<br>    @Override<br>    public void onMessageReceived(RemoteMessage remoteMessage) {<br>        ArrayList&lt;String&gt;notificationString= new ArrayList&lt;&gt;();</pre><pre>if (remoteMessage.getData().size() &gt; 0) {</pre><pre>Map&lt;String, String&gt; dataFromCloud =  remoteMessage.getData();<br>            String action = dataFromCloud.get(&quot;action&quot;);<br>            String userName = dataFromCloud.get(&quot;userName&quot;);<br>            switch (action) {<br>                case actionLiked:<br>                    notificationString.add(action);<br>                    Intent intent = new Intent(this, LikeActivity.class);<br>                    String message = userName +&quot; liked your photo.&quot;;<br>                    sendNotification(message, intent);<br>                    break;<br>                default:<br>                    break;<br>            }<br>        }<br>    }<br>    @TargetApi(Build.VERSION_CODES.M)<br>    private void sendNotification(String messageBody, Intent intent) {<br>        NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);<br>        Intent onCancelNotificationReceiver = new Intent(this, CancelNotificationReceiver.class);<br>        PendingIntent onCancelNotificationReceiverPendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 0,<br>                onCancelNotificationReceiver, 0);</pre><pre>String notificationHeader = this.getResources().getString(R.string.app_name);</pre><pre>NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);<br>        StatusBarNotification[] notifications = manager.getActiveNotifications();</pre><pre>for (int i = 0; i &lt; notifications.length; i++) {<br>            if (notifications[i].getPackageName().equals(getApplicationContext().getPackageName())) {</pre><pre>Log.d(&quot;Notification&quot;, notifications[i].toString());</pre><pre>Intent startNotificationActivity = new Intent(this, NotificationCenterActivity.class);<br>                startNotificationActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);</pre><pre>PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, startNotificationActivity,<br>                        PendingIntent.FLAG_ONE_SHOT);</pre><pre>Notification notification = new NotificationCompat.Builder(this)<br>                        .setSmallIcon(R.mipmap.ic_launcher)<br>                        .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))<br>                        .setContentTitle(notificationHeader)<br>                        .setContentText(&quot;Tap to open&quot;)<br>                        .setAutoCancel(true)<br>                        .setStyle(getStyleForNotification(messageBody))<br>                        .setGroupSummary(true)<br>                        .setGroup(GROUP_KEY)<br>                        .setContentIntent(pendingIntent)<br>                        .setDeleteIntent(onCancelNotificationReceiverPendingIntent)<br>                        .build();</pre><pre>SharedPreferences sharedPreferences = getSharedPreferences(&quot;NotificationData&quot;, 0);<br>                SharedPreferences.Editor editor = sharedPreferences.edit();<br>                editor.putString(String.valueOf(new Random(NOTIFICATION_ID)), messageBody);<br>                editor.apply();<br>                notificationManager.notify(NOTIFICATION_ID, notification);<br>                return;<br>            }<br>        }</pre><pre>intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);<br>        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,<br>                PendingIntent.FLAG_ONE_SHOT);</pre><pre>Notification notificationBuilder = new NotificationCompat.Builder(this)<br>                .setSmallIcon(R.mipmap.ic_launcher)<br>                .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))<br>                .setContentTitle(notificationHeader)<br>                .setContentText(messageBody)<br>                .setAutoCancel(true)<br>                .setGroup(GROUP_KEY)<br>                .setContentIntent(pendingIntent)<br>                .setDeleteIntent(onCancelNotificationReceiverPendingIntent)<br>                .build();</pre><pre>SharedPreferences sharedPreferences = getSharedPreferences(&quot;NotificationData&quot;, 0);<br>        SharedPreferences.Editor editor = sharedPreferences.edit();<br>        editor.putString(String.valueOf(new Random(NOTIFICATION_ID)), messageBody);<br>        editor.apply();</pre><pre>notificationManager.notify(NOTIFICATION_ID, notificationBuilder);<br>    }<br>    private NotificationCompat.InboxStyle getStyleForNotification(String messageBody) {<br>        NotificationCompat.InboxStyle inbox = new NotificationCompat.InboxStyle();</pre><pre>SharedPreferences sharedPref = getSharedPreferences(&quot;NotificationData&quot;, 0);<br>        Map&lt;String, String&gt; notificationMessages = (Map&lt;String, String&gt;) sharedPref.getAll();</pre><pre>Map&lt;String, String&gt; myNewHashMap = new HashMap&lt;&gt;();<br>        for (Map.Entry&lt;String, String&gt; entry : notificationMessages.entrySet()) {<br>            myNewHashMap.put(entry.getKey(), entry.getValue());<br>        }</pre><pre>inbox.addLine(messageBody);<br>        for (Map.Entry&lt;String, String&gt; message : myNewHashMap.entrySet()) {<br>            inbox.addLine(message.getValue());<br>        }<br>        inbox.setBigContentTitle(this.getResources().getString(R.string.app_name))<br>                .setSummaryText(&quot;Tap to open&quot;);<br>        return inbox;<br>    }}</pre><p>Here you will have to clear the saved shared preferences whenever user clicks on the notification i.e. when the new activity is launched or whenever the user cancels the notification from notification drawer. For that we have created a <a href="https://developer.android.com/reference/android/content/BroadcastReceiver.html">BroadcastReceiver</a> which clears all the previously saved notification data.</p><p>Here is the code.</p><pre><strong>public class </strong>CancelNotificationReceiver <strong>extends </strong>BroadcastReceiver {<br>    @Override<br>    <strong>public void </strong>onReceive(Context context, Intent intent) {<br>        SharedPreferences sharedPreferences = context.getSharedPreferences(<strong>&quot;NotificationData&quot;</strong>, 0);<br>        SharedPreferences.Editor editor = sharedPreferences.edit();<br>        editor.clear();<br>        editor.apply();<br>    }<br>}</pre><p>Just call it in onCreate of the Activities which can be opened through notification. In our case LikeActivity and NotificationCenterActivity.</p><p>This is a working piece of code and there is a lot scope for optimization so please feel free to suggest any edits. Hope this will be helpful to someone.</p><p>The <a href="https://play.google.com/store/apps/details?id=io.karavaan.karavaanapp">HopBucket Android app</a> is available for free on the Play Store. You can visit the website at <a href="https://hopbucket.com/">https://hopbucket.com</a> .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f96de7d026a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hopbucket/merge-firebase-notifications-9f96de7d026a">Merging multiple android notifications.</a> was originally published in <a href="https://medium.com/hopbucket">HopBucket</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Our guiding star]]></title>
            <link>https://medium.com/hopbucket/our-guiding-star-fe4f0b6dcfa?source=rss-4661de45b8fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe4f0b6dcfa</guid>
            <category><![CDATA[travel]]></category>
            <category><![CDATA[hopbucket]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[features]]></category>
            <category><![CDATA[star-of-bethlehem]]></category>
            <dc:creator><![CDATA[Chetan Ashtivkar]]></dc:creator>
            <pubDate>Wed, 21 Dec 2016 04:59:49 GMT</pubDate>
            <atom:updated>2016-12-21T15:42:11.869Z</atom:updated>
            <content:encoded><![CDATA[<h4>A new feature that will help you plan the perfect trip</h4><p>At HopBucket we are committed to help you plan the best trip. Using HopBucket you can collect trip ideas from any source including your friends’ trips. This helps you to plan the perfect trip.</p><p>Maps are a key part of the planning process. We understand that one can not simply overlook the geographical positions if one is to plan an exceptional trip. When it comes to planning, restricting the user experience to textual information has its limitations. Our aim is to provide you as much contextual information as possible.</p><p>Today we are releasing our latest feature which allows you to map any trip with just a tap of a button. It is super fast. And it is really convenient. And the best part, like all things HopBucket, it is free!</p><p>Whenever you open your friend’s or fellow traveler’s trip on HopBucket you will see a map icon in the toolbar and one with each place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/234/1*KB4uAQgwfGgNn-k7kuzu7A.png" /><figcaption>The map icon in the toolbar and the one on the image.</figcaption></figure><p>Clicking this icon will open a map which will have all the places from the trip. Consider it as the “Star of Bethlehem” and follow it (just kidding, we are full of Christmas fever)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/234/1*DlIOpbZplOKdnvYfIGZR4g.png" /><figcaption>The map view.</figcaption></figure><p>We hope this new feature will help you create an exceptional trip.</p><p>The <a href="https://play.google.com/store/apps/details?id=io.karavaan.karavaanapp">HopBucket Android app</a> is available for free on the Play Store.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe4f0b6dcfa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hopbucket/our-guiding-star-fe4f0b6dcfa">Our guiding star</a> was originally published in <a href="https://medium.com/hopbucket">HopBucket</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>