Safe Installing from Web on Mac OSX


  • Step 1: You should have md5 tool setup to verify installer/file downloaded from web.
    • brew install md5sha1sum


  • Step 2: Check downloaded file like this:
    • md5sum <path-to-file-to-be-verified>

Android Studio: Files to keep in version control

Here's list of files that should be kept under version control like Git:

  • compiler.xml
  • encodings.xml
  • modules.xml
  • *.ipr : Contains project related data.
File to be included in gitignore OR not to be kept under version control:
  • workspace.xml
  • *.iws : Contains user specific data.

Tinkering with Physical Web (Android)

How to convert a device into beacon (Device 1)


  • Install Beacon Toy application on device that you want to convert/use as beacon.
  • Enable data (wifi or cellular and bluetooth on this device)
  • Configure URL in Beacon Toy application. You also have option to choose to get a short url.
  • I'm using my blog's url for this testing purpose.

How to enable physical web on your device (Device 2)

  • Enable data, location and bluetooth
  • Open Chrome and turn on Physical Web 
    • Chrome --> Settings --> Privacy --> Physical Web
  • Download Physical Web app from Play Store.
  • Open Physical Web app.
    • It'll start scanning all the nearby beacons.
    • It'll pick up Device 1's transmitted url and open my blog :)

Tinkering with Firebase: Notifications

Here are quick steps/tips to integrate Firebase notifications in your client app:

  • AndroidManifest :

<application>
.....
.....
<service android:name=".MyFirebaseMessagingService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT"/> </intent-filter> </service> <service android:name=".MyFirebaseInstanceIdService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> </intent-filter> </service> </application>
  • app/build.gradle:
dependencies {
    compile 'com.google.firebase:firebase-messaging:9.0.2'}

//Make sure to apply it at the end of the file
apply plugin: 'com.google.gms.google-services'
  • Project level build.gradle:
dependencies {
    classpath 'com.google.gms:google-services:3.0.0'
}
  • New Classes:
    • class MyFirebaseMessagingService extends FirebaseMessagingService
      • This is where notifications rendering is handled.

      • Method responsible for message handling: 

      @Overridepublic void onMessageReceived(RemoteMessage remoteMessage) {}

    • class MyFirebaseInstanceIdService extends FirebaseInstanceIdService

      • This class is useful in getting the device token. This token is used if you want to send message to that particular device.
      • This token can be collected: FirebaseInstanceId.getInstance().getToken() during app initialization.


  • Side Notes:
    
    
    • You app should be signed setup for using Firebase by generating and copying google-services.json under your app/ folder.
    • You'll get opportunity to download google-services.json while configuring your Firebase Notifications via Firebase Console.
    • New SHA can be added from Setting tabs under chosen project.

How to keep Multi-Dex issue away !



Configuring gradle plug-in:

Global build.gradle:

classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.0'


Local : app/build.gradle

apply plugin: 'com.android.library'
//AFTER android or library pluginapply plugin: 'com.getkeepsafe.dexcount'






References:
  • http://jeroenmols.com/blog/2016/05/06/methodcount

Rx-Android sample code

There's lots of fuss around Rx/functional programming these day. I wanted to learn by doing, but couldn't find any simple example code to get me started. There're plenty of information for advanced programmers, but nothing basic. So I'm sharing a very simple sample app that uses Rx-Android to do the same thing that an AsyncTask would do. Checkout README for more details.

Source code is here: https://github.com/ptyagi911/rx-android-examples

Super Simple example code for Android Fragment

Looking for easy to follow code to understand Fragments in Android ? You're at right place ! Checkout this sample code in github: https://github.com/ptyagi911/android-fragments-example

Scheduling Repeating Local Notifications using Alarm Manager

Learn about Scheduling Repeating Local Notifications using Alarm Manager in this post .