Android supported Java8 features


  • default and static methods in Interfaces
    • default and static methods can be declared in Interfaces declarations. These methods don't need to be implemented by the Classes that are implementing those interfaces. static methods are attached to the Interface and Classes which implements such interfaces.
    • Reference: https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html
  • Repeating Annotations
    • Now one annotation can be used multiple times on a specific target.
    • Reference: https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html
  • Lambda expressions:
    • Lambda expressions enable to treat functionality as method argument or code as data.
    • Lambda exp is useful especially to define anonymous class with one method
    • Reference: https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html
    • Syntax for Lambda expressions: https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html#syntax

Terms:
  • Functional interfaces: An interface with only method is called as functional interfaces. JDK defines few built-in functional interfaces in package: java.util.function 

How to setup Signing configuration in Android Studio/Gradle

Add following to your build.gradle :



android {

defaultConfig {}
signingConfigs {

   release {
      storeFile file("<path-to-signing-keys>/signingKeys.jks")
      storePassword "your store password"      keyAlias "your chosen alias"      keyPassword "password"
   }
}
You can also publish to playtore by adding following configuration to your build.gradle:
play {
    serviceAccountEmail = 'serviceAccount@gmail.com'    pk12File = file('key.p12')
    track = 'alpha'}

Automatic publishing apk to Google Play Store Developer Console using Jenkins


  1. Jenkins plugins:
    1. Google Play Publishing plugins (only works on Jenkins version > 1.6.09)
  2. Jenkins Build job
    1. Separate build job for each flavor of apk
    2. Create Free style build job in jenkins as described here.
  3. Configure Service Account on Google Play Store as shown here.

Scheduling Repeating Local Notifications using Alarm Manager

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