<?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 Sadman Hasan on Medium]]></title>
        <description><![CDATA[Stories by Sadman Hasan on Medium]]></description>
        <link>https://medium.com/@s4dman?source=rss-56d6ea863051------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*u5OMFjA9AZ-fIetNeepVdA.jpeg</url>
            <title>Stories by Sadman Hasan on Medium</title>
            <link>https://medium.com/@s4dman?source=rss-56d6ea863051------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:04:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@s4dman/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[Android Full-Screen ProgressBar (Indeterminate)]]></title>
            <link>https://medium.com/@s4dman/android-full-screen-progressbar-indeterminate-f932ddf38303?source=rss-56d6ea863051------2</link>
            <guid isPermaLink="false">https://medium.com/p/f932ddf38303</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Sadman Hasan]]></dc:creator>
            <pubDate>Mon, 10 Sep 2018 11:54:28 GMT</pubDate>
            <atom:updated>2026-07-09T05:57:34.487Z</atom:updated>
            <content:encoded><![CDATA[<p>Most of the time, we need a simple and clean loading screen while navigating from one screen to another, especially when the destination screen needs to complete a background task before rendering its UI.</p><p>For example, when I click on the recipe image, I navigate from HomeActivity to DetailsActivity. Inside DetailsActivity, I make an API call to fetch the recipe data, process the response, and then bind the data to the activity_details.xml layout.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D1RcnvyP5tInSxXqCLd7DA.jpeg" /></figure><p>If you search online, you will find many solutions for implementing loading screens. However, in my opinion, most of them are unnecessarily complicated for such a simple requirement.</p><p>The approach I used is just a small trick to achieve the same functionality. The idea is simple: ProgressBar is a view, so why not treat it like any other view?</p><ol><li>Create a simple layout file and name it activity_progress_bar.xml.</li></ol><p>2. Add a basic ProgressBar inside it.</p><pre>&lt;!-- activity_progress_bar.xml --&gt;<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;RelativeLayout<br>    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;match_parent&quot;&gt;<br>    &lt;ProgressBar<br>            android:id=&quot;@+id/progress_bar&quot;<br>            android:layout_width=&quot;wrap_content&quot;<br>            android:layout_height=&quot;wrap_content&quot;<br>            android:layout_centerInParent=&quot;true&quot;<br>            style=&quot;?android:attr/progressBarStyleLarge&quot;/&gt;<br>&lt;/RelativeLayout&gt;</pre><p>3. Inside the onCreate() method of your destination activity (in this case, DetailsActivity), load the progress bar layout first.</p><pre>@Override<br>protected void onCreate(Bundle savedInstanceState) {<br>    super.onCreate(savedInstanceState);<br>    setContentView(R.layout.activity_progress_bar);<br>    // Initiate the task you want to perform    <br>    getRecipeDetails();<br>}</pre><p>Now, when you navigate from HomeActivity to DetailsActivity, the user will immediately see a loading indicator while the background task is running.</p><p>4. Once the data is ready and you are ready to display the actual content, simply replace the progress layout with your actual activity layout using setContentView().</p><p>For example, if you are using AsyncTask for a network request, you can render your UI inside the onPostExecute() method and continue with the remaining tasks.</p><p>In this example, I used the <strong>Fast Android Networking Library</strong> for the API request, so I loaded the details layout inside the onResponse() callback.</p><pre>// getRecipeDetails();<br>AndroidNetworking.get(&quot;https://www.yourapiurl.com&quot;)<br>        .setPriority(Priority.MEDIUM)<br>        .build()<br>        .getAsJSONObject(new JSONObjectRequestListener() {<br>            @Override<br>            public void onResponse(JSONObject response) {<br>                try {<br>                    setContentView(R.layout.activity_details);<br>                    // Continue with the remaining tasks<br>                } catch (Exception e) {<br>                    e.printStackTrace();<br>                }<br>            }<br>        });</pre><p>And that’s it. Simple as that!</p><p>Extra: If you want to change the default color of the progress bar, you can do it like this:</p><pre>ProgressBar mProgressBar = findViewById(R.id.progress_bar);<br><br>mProgressBar.getIndeterminateDrawable()<br>        .setColorFilter(<br>            Color.parseColor(&quot;#E33D26&quot;),<br>            PorterDuff.Mode.MULTIPLY<br>        );</pre><p>If you have any questions, suggestions, or a better approach, feel free to share them in the comments below.</p><p><em>Happy Coding!</em> :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f932ddf38303" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[iOS Push Notification for Ionic]]></title>
            <link>https://medium.com/@s4dman/https-medium-com-s4dman-ionic-push-notification-ios-90b49763b54b?source=rss-56d6ea863051------2</link>
            <guid isPermaLink="false">https://medium.com/p/90b49763b54b</guid>
            <category><![CDATA[push-notification]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ionic]]></category>
            <category><![CDATA[app-store]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Sadman Hasan]]></dc:creator>
            <pubDate>Mon, 16 Oct 2017 04:39:15 GMT</pubDate>
            <atom:updated>2018-09-10T17:39:40.744Z</atom:updated>
            <content:encoded><![CDATA[<h3>iOS Push Notification for IONIC</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*CBZ2NVQsDcjlQkj7FpfoWA.png" /></figure><p>I’ve been working with Ionic for almost 2 years. There’s no doubt it’s a top notch framework for building hybrid apps as it offers a native looking UI out of the box, easy to use CLI, it uses Cordova plugins for native APIs like Camera, Geo-Location, Push Notification and many more.</p><p>Over the year while developing apps for both iOS and Android, I had to implement Push notification service on some of my apps. As Apple’s dev tree is much more complicated than android and lack of community support caused me enormous amount of errors and debugging. So this post is for them who’s banging their heads or hammering their keyboards right now.</p><p>There are three steps.</p><ul><li>Install <strong>Push plugin</strong> and configure your app.</li><li>Create <strong>APP ID</strong></li><li>Generate <strong>APNS Certificate</strong></li></ul><p>First fire up your terminal and goto project’s root directory and install push plugin using the following command :</p><pre><strong><em>cordova plugin add phonegap-plugin-push --variable SENDER_ID=&quot;1234567890&quot;</em></strong></pre><p>You don’t need to worry about the SENDER_ID, just leave as it is. To check if the plugin is properly installed, run the following command:</p><pre><strong><em>cordova plugins ls</em></strong></pre><p>You’ll see a list of installed plugins in your app. Or you can check your <strong>package.json</strong> file, you’ll see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*rRGQaDLXJ7T2GPQh_smb4Q.png" /></figure><p>Then add the following codes inside you <strong>service </strong>:</p><pre>var push = PushNotification.init({<br>	ios: {<br>		alert: &quot;true&quot;,<br>		badge: true,<br>		sound: &#39;false&#39;<br>	}<br>});</pre><pre>PushNotification.hasPermission(function(data) {<br>  if (data.isEnabled) {<br>     console.log(&#39;isEnabled&#39;);<br>  }<br>});</pre><pre>push.on(&#39;registration&#39;, function(data) {<br>      console.log(data.registrationId);<br>      // registrationId is the device token. <br>      //Store or send it to your server based on your requirements.<br>});</pre><pre>// The following event will be triggered each time a push notification is received by a 3rd party push service on the device or when you will tap on the notification.</pre><pre>push.on(&#39;notification&#39;, function(data) {<br>	console.log(data);<br>        // Handle your data here<br>});</pre><pre>push.on(&#39;error&#39;, function(e) {<br>	console.log(e);<br>});</pre><p>That’s all on your end. Next we will create our <strong>APP ID</strong> and <strong>APNS certificate</strong> in our <strong><em>Apple developer account</em></strong>.</p><p>Now login to your apple developer account and click on <strong>Certificates, Identifiers &amp; Profiles &gt; APP IDs. </strong>Then click on <strong>+ </strong>button on top right and create a new APP ID for you app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TeDEUMXk-VhdXgDB0oT6fA.png" /><figcaption>Your APP ID name</figcaption></figure><p>Next, your <strong>Bundle ID </strong>must be the same as your app package name. Open your <strong><em>config.xml</em></strong> file and copy the <strong>widget id<em> </em></strong>here. (example: com.ionicios.pushnotification)</p><p>Then check <strong>Push Notification</strong> from <strong>APP Services </strong>and click continue. Next page will look like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*SteD2PGj-NTHfae0ecHOxQ.png" /></figure><p>Click <strong>Register</strong> and <strong>Done</strong> to complete the process.</p><p>Next we will create APNS Certificate.</p><p>Login to your Apple developer account and goto the App ID you just created and click on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OGhOuasJBCJxOciWKVh4Ug.png" /></figure><p>You’ll see that Push notification status for both Development and Distribution is “Configurable”. That means we haven’t configured our Push Notification service for the app. Now click on edit and scroll down to Push Notification section and choose which certificate you want to create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*tiV76gExKOjhmM09cBvk9Q.png" /></figure><p>At this moment we will create a Development certificate. So click on <strong>Create Certificate</strong>.</p><p>Click <strong>continue </strong>when you’re in <strong>Create a CSR file</strong> section. On the next page <strong>Generate your certificate,</strong> it’s asking you to upload a <strong>.certSigningRequest </strong>or CSR file from your Mac.</p><p>To create the CSR file, launch your <strong>Keychain Access </strong>from your Mac and select the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*Lm_yyzTZZZMq9FwmSOtDJQ.png" /></figure><p>Enter the information required and choose <strong>Saved to disk. </strong>Click continue and save it in your folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*-wxp1z7S76du5O-NqzFwbw.png" /></figure><p>Now upload the certificate we have just created and click on continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*nBV_C8yO-JYtvuH5rlCwHA.png" /></figure><p>Your Development SSL certificate will be generated.</p><p>Download the certificate. It will be saved in <strong>.cer</strong> format. Double click it to install the certificate in your Mac’s keychain access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*d76of4RiXE848lHwFnbUWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*3pU1P_E4-yk1Ale3kdGH6Q.png" /></figure><p>Launch keychain access and select login and My Certificates from Category from left side panel and identify the certificate you just installed which is now paired with a private key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*MHShDC-rE7Eq6A-bxOum_A.png" /></figure><p>Select both the certificated and private key and right click on it. Select <strong>Export Apple Development iOS Push Services. </strong>Save the file as <strong>p12 </strong>fromat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*JHxKS5aY8kUadtRxU4D-mw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*_YH3WZJEjq0oDpOz6yEfhQ.png" /></figure><p>Enter the password for exporting. Remember the password as it will need in future. Click <strong>OK</strong> to complete exporting the certificate.</p><p>Now go back to App IDs and Click on your app id and you’ll see that Push Notification status for Development is changed to <strong>Enable.</strong></p><p>Now use that p12 file based on your preference on you back-end server or wherever necessary.</p><p>Similar way you’ll create certificate for <strong>Distribution</strong> when you’re ready to launch your app for distribution on App Store.</p><p>For further query you can comment below or ask me at <strong><em>hasansadmans@gmail.com. </em></strong>I’ll be glad to help you.</p><p>Happy Coding :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90b49763b54b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>