“Hello, Kotlin!” in Android

There are two ways you can get Kotlin for the Android studio. The simplest way to get Kotlin support is to download Android Studio 3.0 Preview (Canary version). Android Studio 3.0 comes with Kotlin bundled in it. You can keep both earlier version of Android Studio and Android Studio 3.0 side by side. If you don’t want to download Android Studio 3.0 then you can still get Kotlin support by installing the plugin.

Installing Kotlin Plugin for existing Android studio version (which is not a version 3.0) -
Go to Android Studio > Preferences > Plugins. You will see the following screenshot. Tap on Install JetBrains plugin button.

Installing Kotlin Plugin for existing Android studio version (which is not a version 3.0) -
Go to Android Studio > Preferences > Plugins. You will see the following screenshot. Tap on Install JetBrains plugin button.

Then it will ask you for the plugin to be installed from JetBrains plugins list. As shown in the below screenshot, search for Kotlin and tap on Install button to install Kotlin plugin.

Once the plugin is installed it will ask you to restart the Android studio. Restart it and you have Kotlin plugin in your Android Studio.

We will use Android Studio 3.0 for the “Hello World” program in Kotlin.

Create New Project with Kotlin

You can easily create a new project in Kotlin with few seconds using Android Studio 3.0.

  • If you have a welcome screen open for Android Studio 3.0 then click on Create new project. You have to then check Include Kotlin Support. Click on Next button to complete project setup.
  • If you already have Android project open, go to File > New > New Project and follow the same step as mentioned in #1.

Once your project is created, you will see MainActivity with “.kt” extension instead of Java. Your MainActivity code in Kotlin looks like -

package com.hellokotlin

import android.support.v7.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {

If you run the default app, you will see “Hello World!” label displayed at center of the screen. Hola!! You just created your first “Hello world” Android Application in Kotlin. We can go one step further and create button and implement its click listener.

  • Change Label element in main.xml file to Button and set its text to “Tap me!”.
  • Go to MainActivity.kt file.
  • Create variable for the button as
val tapMeBtn = findViewById(R.id.btnTapMe) as Button
  • Implement Onclicklistener as
tapMeBtn.setOnClickListener(View.OnClickListener {
 Toast.makeText(this, "Hello Kotlin!", Toast.LENGTH_SHORT).show()

That’s it!! If you run the application, you will see “Tap me!” button on the screen. Tap on the button and it will show Toast message saying “Hello Kotlin!”.

Kotlin, Official Support Announced for Android!!

Finally, an Android developer can say they have some official language to build Android apps. Google has announced official support for Kotlin programming language. We have been using Java for Android apps development ever since (except C++ in NDK) and also struggling to overcome Java issues we have been facing for years. No more fears of NullPointerExceptions!! Kotlin has come to our rescue.

What is Kotlin?

Kotlin is statically typed programming language designed to support multi-platform applications including Java virtual machine (JVM), browsers and Android apps. It runs on JVM. Kotlin was unveiled to the world in 2011 and its first stable version v1.0 was introduced in 2016 after years of development efforts.

Kotlin Features - Kotlin has really cool features.

  • Conciseness - You don’t have to write boilerplate code in Kotlin as it has pretty concise syntax.
  • Handling NullPointerExceptions - If you are afraid of unknown NullPointerExceptions, let this worry fade away with Kotlin as this programming language is much safe to avoid entire classes of errors.
  • Interoperable with other languages - If you are a Java developer or Android developer (where Java is used), Kotlin can be alternative for you as it is 100% interoperable with Java.
  • Tool-friendly - Kotlin is compatible with Java-based IDEs making it easy to switch to Kotlin.

Why Kotlin support for Android

During Google I/O 2017, Google announced official support for Kotlin programming language for Android development. As mentioned earlier, Kotlin is interoperable with Java, many developers were already using it for Android development and were hoping to get official support from Google. Kotlin has early adoption by many developers like Expedia, Flipboard, Pinterest, Square, and others. Kotlin is chosen for Android due to following facts -

  • 100% interoperable with Java. So you can use both Kotlin and Java in the same app
  • Easy to use making app development faster
  • No more NullPointerExceptions at runtime
  • Smart casting of variables
  • Destructuring declarations
  • Importantly supports Lambda functions

Kotlin is bundled with Android Studio 3.0. So you don’t have to worry about adding plugins for Kotlin. Just download Android Studio 3.0 (make sure you get canary version) and get started.

So if you are experienced Android developer, you don’t need to stop using Java immediately but definitely, need to learn Kotlin. If your knowledge lackluster Android development skills, no worries, you can still jump on Android development by starting Kotlin learning.

Android - O, Developer Preview is Here! What’s New?

It’s been around two weeks when Google announced Android O preview. This is again exciting time of the year when you can try out all new features of Android’s upcoming OS version Android - O (what is your guess about ‘O’?) before it is released and keep your apps ready for new OS version support. As it happens with every Android OS version, Android O also brings many new features and some optimizations techniques to make better apps. Here are some of the new features -

Background Limits - A few years back, Android background service implementation was one of the comparison points with iOS. Android Nougat introduced some changes in background service implementation and now with Android O preview, there will be major changes in it. Background service implementation will have certain limitations divided into three major areas viz. implicit broadcasts, background services and location updates. All these changes are introduced to limit background usage and improve interactive performance by improving RAM usage.

  • Implicit broadcasts -
    • Apps targeting Android O will no longer receive implicit broadcasts in the background to most manifest declared receivers.
    • Some of the exceptions to implicit broadcast change will be
    • Apps can receive implicit broadcasts only when an app is active.
    • There is no change in the explicit broadcast that targets application package registered in the manifest. It will work as it is.
  • Background services -
    • Android-O puts a limit on how long background service can stay alive once the app goes to background. Background service can now only run for short time after the app has no longer visible activity or any foreground service.
    • startService or service PendingIntent will throw an IllegalStateException when an app is not in the foreground.
    • Above mentioned background service changes do not impact foreground services. For example, foreground services which require persistent notifications, work as usual and there is new service to start service in Foreground which is NotificationManager#startServiceInForeground.
    • There is another catch though, there will be some changes to background services even if your app does not target Android O such as Wakelock will be released when your app enters the cached state where there is no active Android component.
  • Location updates -
    • Android play store is flooded with many location-based apps as Android till date supported background location updates. Android-O restricts background location updates. Now your app can request background location updates just a few times per hour.
    • Location updates in foreground services are not impacted by this change. So apps which do location tracking in real time using foreground service will work as it is.
    • Your background app can take advantage of another foreground app which is getting location updates. It can then get location updates with the same frequency as that of foreground app.

User Privacy - Android always emphasis on protecting user’s privacy. Android-O also does certain modifications to protect user’s privacy.

  • ANDROID_ID Change - There are some changes in Android ID settings for apps and it will be noticed under Settings.Secure.ANDROID_ID. Prior to Android-O, Settings.Secure.ANDROID_ID was same across all apps but now with Android-O, ANDROID_ID will be different per app per user. This value will persist across app reinstalls. Google still recommend using user-resettable advertising id provided by Google Play service for simple, standard system to help monetize the app
  • Account Access -
    • App will not be able to get account access directly using GET_ACCOUNTS permissions. App will have to rely on account choosing activity.
    • With Android-O, account owners can now choose whether accounts should be visible to other apps. Accordingly, Account choosing activity API will be updated.

Notifications Channel - Android-O adds notifications channel to give a user more control over notifications and app developer more flexibility with notifications to be sent.

  • The app developer has to use Notification channel for Android O otherwise notifications will not be shown for the app.
  • Notification channel is named category of notifications from the single app. You can use notification channels to have different categories of notifications.
  • User can block category or alter its behavior like change importance, add vibrations or lights, an ability to snooze, set timeouts to cancel etc. User can long press on notification to bring out notification channel settings.
  • Check implementation details of notification channel.

Autofill framework - Chrome browser is a well known example where users can avail autofill feature while filling out repetitive information on the web. Android-O introduces Autofill framework so Android apps can make form filling tasks easy to the users.

  • With Android-O, now user can select autofill app similar to the way keyboard app is selected.
    • Autofill app is responsible for storing and securing user data such as name, addresses, phone numbers, email, password or even credit card information etc.
    • New View API is also introduced in custom views to expose metadata to Autofill framework.
    • Click here for more details about autofill framework

Picture-in-Picture - Picture in Picture (PIP) mode allows your video activity to play in pinned window mode when another foreground activity or app is running. Earlier to Android O, PIP was supported only for Android TVs but now you can use PIP feature in Android O targeted apps on other Android devices as well.

  • To implement the Picture-in-Picture feature, all app has to do is to call the enterPictureInPictureMode method from resume or pause state of your media activity.
  • You can set picture in picture aspect ratio of mobile devices along with custom remote actions that allow user to interact with picture in picture activity using setPictureInPictureArgs(PictureInPictureArgs);
  • Make sure you continue playback in paused state if you are adding PIP support in your app.

Multi-display support -

  • Rather than having an app explicitly use the presentation API, regular activities can now be launched on secondary displays.
  • These displays have per display based configuration and resource management. This means some of the parts of a configuration such as a screen width DP, screen height DP layout, density DP will be set accordingly to the display on which activity currently resides.

Font resources - Finally, Android-O makes custom font implementation easy with font resources support.

  • Fonts are fully supported resources type in Android-O.
  • Now app developer can get font by just calling the getFont(int) method to get font by ID.

    Typeface font = mResources.getFont(R.font.myFont);
  • You can also declare entire font family in XML file, declaring font style, weight along with font resource.

Connectivity -

  • Android O will now support Bluetooth CODECS LDAC CODEC.
  • Wi-Fi Aware is a new feature added in Android-O which was previously known as Neighbor awareness networking (NAN). Devices with required hardware will be able to communicate over Wifi without an Internet access point.
  • Android-O adds ConnectionService APIs so third-party calling apps can work seamlessly with system UI and other audio apps.

WebView API enhancements - We will see a lot of webView API enhancements to improve app’s stability and security in Android-O. Following set of APIs are introduced in Android-O for webView -

  • Version API
  • Google Safe browsing API
  • Termination Handle API
  • Renderer Importance API

Pinning shortcuts and widgets - If you are a big fan of 3D touch feature in iOS, you will love pinning shortcut feature of Android-O.

  • Now app user can access key features of the app directly from app icon from launcher screen.
  • Developers can pin shortcuts to specific tasks to app icon on launcher screen yet giving control to a user whether to see pinned shortcuts for that or not.
  • Launcher will show confirmation dialog asking user’s permission to pin the shortcuts. If a user declines, launcher app will not show pinned shortcuts.
  • Similar to pinned shortcuts, users can pin widgets to the supported launcher.
  • Just remember, pinned shortcuts and widgets will work on devices running Android-O with launcher supporting pin feature.

Adaptive icons - Android O can now display a variety of shapes for app icons across different device modes. Display of icons depends on OEM mask. Click here for more details about Adaptive icons.

So Android developers, get ready to explore Android-O preview for these and many other features.

Your App Needs an Update to Utilize Extra Space Available on Samsung Galaxy S8

Samsung has announced their newest phones Galaxy S8 and Galaxy S8 Plus. Galaxy S8 and Galaxy S8 Plus are one of the largest smartphones of the year.

Samsung Galaxy S8 has a screen size of 148.9 x 68 x 8mm, while the Samsung Galaxy S8 Plus is 159 x 74 x 8mm. So definitely these devices have highest aspect ratio. Galaxy S8 has aspect ratio 18.5:9. As aspect ratio is increased, it is a time to update your app to support maximum aspect ratio to utilize extra space available on the screen. Android APIs has made this task easy. You can support maximum aspect ratio for Android apps by adding following piece of code in the Manifest file of an app. Insert android.max_aspect <meta-data> element in the app’s <application> element

<meta-data android:name="android.max_aspect"

The value of Android.max_aspect should be ratio_float if you want to build an app for maximum supported aspect ratio. You can set float value for this param instead of “ratio_float” if you know maximum aspect ratio your app should be supporting. Please make a note if you do not set the value and if android:resizeableActivity is not true, then the maximum aspect ratio defaults to 1.86 (which is roughly 16:9). So in order to take advantage of extra space available on the screen for larger devices, make sure you are setting a right value for Android.max_aspect.

LG has also announced new phone early this year LG G6 which has aspect ratio of 18:9. So if you want to support newest devices like Samsung Galaxy S8 and LG G6, make sure you declare right elements in the manifest file of your app for the desired aspect ratio support.

What is new in TensorFlow 1.0?

Many engineers and researchers from deep learning field must be familiar with TensorFlow platform. Google introduced TensorFlow, an open source system for machine learning in 2015 and yesterday (Feb 15, 2017) at Google’s inaugural TensorFlow Dev Summit in Mountain View, California, they announced a new release of TensorFlow, version 1.0. Before jumping to TensorFlow 1.0 release update, let’s just catch up with what is TensorFlow!

What is TensorFlow?
TensorFlow is an open source machine learning library which was initially developed by engineers and researchers at Google Brain Team. Google made it open source in 2015. TensorFlow library can ease the process of applying deep learning algorithms into various areas. Graphical representation of mathematical operations simplifies the deep learning algorithms implementation. It is based on data flow graphs where graph node represents mathematical computations, while the graph edges represent the multidimensional data arrays (which they call as tensors) communicated between them.

What do you need to know before getting started with TensorFlow?

  • How to code in Python
  • Mathematical operations at least about Arrays
  • Some knowledge of machine learning

About TensorFlow 1.0
Google claimed that TensorFlow 1.0 is now more production ready than ever, faster than earlier, more flexible and with more stable Python APIs. Many tools have been added to the framework which makes TensorFlow much better.

  • Faster than earlier: XLA (Accelerated Linear Algebra) now lays a foundation to the optimized TensorFlow v1.0. XLA is domain-specific compiler to speed up TensorFlow computations. It is in an experimental phase (alpha) and one can play with it via Just-in-time (JIT) compilation or ahead-of-time (AOT) compilation. XLA not only speed up the computations but also improves memory usage. Check out XLA details here.

  • More flexibility: Addition of new APIs and modules like tf.layers, tf.metrics, and tf.losses modules makes TensorFlow more flexible. TensorFlow 1.0 now also compatible with Keras which is another neural network library written in Python.

  • Python API changes: Changes in major Python APIs which now resembles with NumPy (fundamental scientific Python package for computations) are not backword-compatible. Older programs might not run on TensorFlow 1.0 as expected so this migration guide may come handy to upgrade your programs to V1.0

  • Java and Go support: TensorFlow 1.0 now adds APIs for Java and Go programming languages (experimental as of now).

  • TensorFlow Debugger: (tfdbg): TensorFlow 1.0 introduces new command line debugger so develoeprs can now debug live TensorFlow programs.

  • New Android demos: New demos are created with TensorFlow 1.0 release for Android which showcase object detection and localization, camera-based image stylization.

  • Installation improvements: TensorFlow instllation is made easy with Python image docker and PyPI compliant pip packages. Check out TensorFlow instllation details here..

Find out more about TensorFlow 1.0 in release notes.

Gmail authentication error on less secure apps

Integrating Google login in the mobile apps, web apps is a trend! To follow this trend, keeping up with everyday advancing Google’s settings is itself a challenge especially if you are using a third party open source library which uses Google login in it.
In the past, I worked on open source K9 mail app to create custom mail app. It allows users to do gmail login. Recently, K9 app started giving me an authentication error even after entering correct gmail credentials.

Googling itself helped me to figure out the solution. It is because a change in the process of using Google authentication within your own app. Most of the apps recently started throwing the same exception as Google marked these apps as a less secure app including Outlook mail app (Ref.https://support.microsoft.com/en-us/kb/2984937). Because these apps might be still using an old process of doing Google login.
The best way to get out of this issue is updating your apps, open source libraries with latest Google authentication process. But there is always a workaround to fix something temporarily. So here is the quickest hack-

Hope this simple hack saves someone’s time!!

Android screen recording using FFMPEG and Java OpenCV

Think of the feature where activities you perform on mobile app screen is recorded as a video. Screen video recording can be useful in drawing kind of apps where you are recording video of your drawing as you progress.
Android SDK comes with many powerful features to implement wide variety of the apps starting from utility apps to enterprise apps. But sometimes it really becomes cumbersome to implement desired feature due to limitation of android OS. Screen video recording feature in the android app is one of them. Android OS has restricted access to mobile screen through any app. There are few applications over Google play store which provide screen video recording feature. But they demand for root access on your device which means your android device has to be rooted to use such applications. If you are developing app for general users then rooting of the device can’t be solution just to have screen video recording feature as not everybody likes to play with their phones by rooting it.

Kitkat 4.4 built in screen video recording feature

Kitkat came with in built screen recording feature using ADB(Android Debug Bridge). But it does not serve above mentioned requirement as screen recording is done from the command line. This can be useful when you only have to create screen recording video for complete application to show how does app work.

Libraries to create video from images in JAVA/Android

FFMPEG is library which can be integrated in android app using android NDK(native development kit). It needs working android NDK copy to build this. However you can still find already built files which can be imported in you android app source code without NDK using java OpenCV library. Java openCV library is a wrapper for FFMPEG written in java. Java OpenCV can be simplest way to integrate FFMPEG to create video from sequence of images in android app.
You can download libraries needed from http://search.maven.org/remotecontent?filepath=org/bytedeco/javacv/0.8/javacv-0.8-bin.zip. You can always look on web for latest version of these jars. Once you download zip from above location, you need to copy javacpp.jar, javacv.jar to your project’s libs folder(project folder/libs). Another required jar is opencv-android-arm.jar. Extract opencv-android-arm.jar to get armeabi folder. Copy this armeabi to your project’s libs folder(project folder/libs).

Creating video from sequence of images stored on SD card

Once you import all required jars into your project. You are all set to start coding to create video from sequence of images. You can find pieces of codes as follows - You need import following packages.

import com.googlecode.javacv.FFmpegFrameRecorder;
import com.googlecode.javacv.cpp.opencv_core;
import com.googlecode.javacv.cpp.opencv_core.IplImage;

Following function will create video from list of images. All one has to do is to provide path of images on SD Card.

private void record() {

        Log.d("Record", "Environment.getExternalStorageDirectory().getPath()  : " + Environment.getExternalStorageDirectory().getPath());
        String path = Environment.getExternalStorageDirectory().getPath() + "/Video_images"; // You can provide SD Card path here.

        File folder = new File(path);

        File[] listOfFiles = folder.listFiles();
        IplImage[] iplimage = null;
        if (listOfFiles.length > 0) {

            iplimage = new opencv_core.IplImage[listOfFiles.length];

            for (int j = 0; j < listOfFiles.length; j++) {

                String files = "";

                if (listOfFiles[j].isFile()) {
                    files = listOfFiles[j].getName();
                    System.out.println(" j " + j + listOfFiles[j]);

                String[] tokens = files.split("\\.(?=[^\\.]+$)");
                String name = tokens[0];

                Toast.makeText(getBaseContext(), "size" + listOfFiles.length, Toast.LENGTH_SHORT).show();

                iplimage[j] = cvLoadImage(Environment.getExternalStorageDirectory().getPath() + "/Video_images/" + name + ".jpg");



        FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(Environment.getExternalStorageDirectory().getPath() + "/Video_images/output" + System.currentTimeMillis() + ".mp4", 200, 150);

        try {
            recorder.setVideoCodec(13); // CODEC_ID_MPEG4 //CODEC_ID_MPEG1VIDEO
                                        // //http://stackoverflow.com/questions/14125758/javacv-ffmpegframerecorder-properties-explanation-needed

            recorder.setFrameRate(1); // This is the frame rate for video. If you really want to have good video quality you need to provide large set of images.
            recorder.setPixelFormat(0); // PIX_FMT_YUV420P


            for (int i = 0; i < iplimage.length; i++) {


            Toast.makeText(MainActivity.this, "Record Completed", Toast.LENGTH_SHORT).show();

        } catch (Exception e) {

Above code creates video from images stored on SD card in Video_images folder. It creates video and stores created video on SD Card in folder- /Video_images/output/ with video name as current time-stamp with mp4 extension. In above code you can choose your own frame rate using following line -


If you have large number of images to create video then you can set higher frame rate. But drawback of this method is this method takes time to create video and save it on SD Card.

Using above method in drawing like app to create video of screen drawing

If you want to use above method in drawing like app to capture drawing video best way would be to capture images of parent layout per second and store on SD card. You can initiate this process when user clicks on start recording button. When user clicks on stop recording, you can stop capturing images and call above method providing path of your temporary folder where you saved captured images.
Hope this helps you to create video of screen recording without rooting your device!

Facing Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536 issue?

Conversion to Dalvik format failed:
Unable to execute dex: method ID not in [0, 0xffff]: 65536

Are you stuck with above two lines while building your android app? Yes this happens when you are building large application which has added many references libraries in your code.
Before moving forward to check solutions for this issue, few things which one should know about why this issue occurs.

Why this issue occurs :

As you go on building large applications, your code size reaches certain limit for total number of methods in the app. Total number of methods referenced by the app does not only include methods written by you but also include methods bundled in external jars, library files which you have added into your project. You must be knowing architecture of android app (APK) which internally contains bytecode files in the form on Dalvik executable (DEX) files. Android has put an upper limit on total number of methods referenced by a single DEX file and which is 65536.
Now you can see 65536 in error which you are getting which itself signifies DEX file of your APK has referenced more than 65536 methods. And this is why issue - Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536 occurs in your code.

Avoiding reaching 65536 method limit

Taking few cautious decisions and careful thinking while writing your code since beginning can save you. Always check you are not keeping any unused code in code files. Whenever you are adding any third party lib, you use most of the library functions instead of adding your own. Make sure you do not add any large lib just for couple of methods.
Reusable, neat and clean code and proper architecture of project can help you to avoid reaching 65536 methods limit.

How to resolve?

Android architecture has also provided solution to resolve this issue. Multidex files is the one solution which you can use to resolve issue of 65536 methods limit. But there are other simple approaches which one can use to resolve this issue. I will discuss multidex file support sometime later in another post. Let’s see initial step towards resolving issue i.e ProGuard

ProGuard Configuration :

Android has provided ProGuard tool which optimizes your code by removing unused code, methods. This reduces size of your app (APK). By default ProGuard configuration is not enabled when you create Android project. One can configure ProGuard by following few steps.

  1. ProGuard tool is found in your SDK path at {SDK_FOLDER}/tools/proguard/
  2. Above mentioned ProGuard folder from SDK has proguard-android.txt which plays major role when you enable ProGuard setting for your project
  3. Open project.properties file in edit mode (any simple editor will suffice) which will be in your project folder
  4. You can following see line in it

This line must be preceded with # (# is to comment whole line in project.properties file). Un comment this line by removing preceded #. Your SDK path has to be set in environment variables.

  1. Your configuration is done. Clean the code, build it and run it. If it runs successfully you must see proguard.txt file in bin folder of your project.
  2. After configuring ProGuard, if app still shows same issue of 65536 limit you can try un checking Private Libraries from build path in project properties. Please see below screen shot for reference.

    After this step again clean the code, build and run the app

ProGuard is not full proofed solution to resolve 65K methods limit. However ProGuard will resolve the issue if DEX file from reduced size APK contains methods less than 65K after shrinking, obfuscation of code and removal of unusedcode code by ProGuard tool. If final DEX file still references more than 65536 method then one may have to go for multi DEX solution!

Everything one needs to know before choosing advertisement platforms for mobile app

Being an android developer and a project manager in most of the projects, got opportunity to work in depth on advertisement platforms integration in mobile app. Integration of ad platform in mobile app is simplest and easiest way to start monetization. Experience of working with different ad platforms made me thought about questions which one should ask before they choose ad platform to start revenue through their mobile apps.

What kind of ads do you want to show in your mobile app?

Ad platforms have introduced many flavors of ads to be shown through the mobile apps. Few of them are

  1. Banner ads -

    • Ad displayed in the form of banner either on top/bottom of the mobile app.
    • One should verify available sizes of banner for particular ad platform. Because sometimes banner ad appears at the center of the device irrespective of device’s size. It does not fill complete width of the device. One should be concerned about this if UI of the screen is one of the major concerns
    • One can make money out of banner ads if they provide a feature to purchase an app to see ads free version. As banner ads appears on every screen user might like to buy ads free version.
    • Check if banner ads are available for phones, tablets etc. in case of android as it comes with wide range of devices in terms of the size
  2. Interstitial ads -

    • Ads displayed in the form of full screen which can be popped up sometimes when user is going through the app.
    • Preferred for games or gaming kind of apps.
  3. Native ads

    • Native ads are kind of ads which can be shown in between your list items which more or less will look like your list items.

      • These ads come with action buttons like “Install”, “Download” etc.

      • These can be shown after every set of your own list items.

    • Flexible enough to fit into your own list view UI
  4. Video ads

    • Videos are shown in the full screen.

      • These can work best if you are developing some kind of videos apps.

Here are the questions to be asked to yourself before you choose or integrate ads network

  1. What all kinds of ads I want to integrate in my mobile app?
  2. Have I done enough research about target ad platform I am going to integrate?
  3. What is fill rate of type of ad for this particular ad platform?
  4. Can I integrate different ad platform through some mediation platform?
  5. If I am planning to integrate particular ad platform as a mediation for third party ad networks, how many and which ad networks can be route through this?
  6. Does ad platform has proper and well documentation for integration guide (this is also important otherwise most of the time you can end up in things not working as the way you expected them).
  7. Does ad platform provide in house ads feature? (In house ads are your own customized ads or ads for your other apps or maybe for the publishers who are ready to show their ads through your app)
  8. Does target ad platform has enough ads available on their marketplace for the country or region your app is targeting? (Most of the ad platform works better in US but does not seem to work in India)
  9. Do I need random ads from ad platform? Or do I need to filter ads depending on criteria by age group, location or categories etc.?(ad platform allows to set many parameters to filter out ads. One can avoid this as it might reduce ads fill rate.)
  10. Have I checked terms and conditions for ad platform integration whether I am fulfilling criteria or not? Chances of skipping this step are higher if any third party developer is taking care of setting up an ad platform account on behalf of you for your mobile app.
  11. Have I checked terms and conditions for payment system for withdrawing revenue from ad platform integrated?
  12. Importantly, have I made sure that my ad integration won’t annoy target audience and it will give better user experience yet earning enough from ads integration?
    Above checklist may add or remove few questions as this may vary with ad platforms. However asking few questions before you choose or integrate any ad platform into your mobile app and putting some well planned algorithm in place may turn into good monetization strategy for your app.

Here is quick tip to avoid trouble of getting blocked by ad platform provider

To test ad platform integration one might go for live ads and these can get number of hits knowingly or unknowingly which ad platform provider might think as spamming. And your ad platform account might get blocked. So make sure you test live ads yet avoid unnecessary hits on it to get into hassle of account blocking.

Few of the ad platforms

  1. Google admob - http://www.google.com/ads/admob/
  2. MoPub ads - http://www.mopub.com/
  3. InMobi ads - http://www.inmobi.com/
  4. Mmedia ads - http://mmedia.com/
  5. Adcolony ads - http://www.adcolony.com/
  6. Flurry ads - http://www.flurry.com/solutions/publishers
    Hope this information helps someone to get onto right path while choosing Ads platforms!

Temporary Google glass emulator - Turn your phone into Google Glass

If you are looking to experience Google Glass without actually buying such a expensive device, then you can simply download some apks which can turn your Android device into Google Glass.
Android device can be made to function like Google glass by installing few apks.
Found two links which gives step by step guideline to do this.

  1. https://github.com/chariard0008/google-glass-emulator

  2. https://github.com/zhuowei/Xenologer#install

Steps to make your device to function like Glass

  1. Install all the apks available on #1 link mentioned above.
  2. Do not open any of the app after installation.
  3. Login to https://accounts.google.com/myglass to setup your glass. Follow all steps here. It might fail at step to connect to your wi-fi. It worked for me after several retry.4. Open Glass home app installed in #1 link.
  4. You can see Glass on your Android device.

My observations about this simulated Glass

  1. One can use Mirror APIs to push cards (static or live cards) from cloud/web on this simulated glass.2. You will see few commands on next screen when you say “ok glass” from home screren.
  2. Camera and other few options does not work. It crashes.4. One can see how menu options works for Google glass app using Google search feature which you see on this simulated glass.Google search is opened when double tapped on glass home screen. Pages seen from Google search are later shown in past cards of glass timeline when you swipe right to left from home screen.

I created one simple hello world application for Google glass. Tried to run this application on Android device which is now simulated Glass. Here are my observations for this test.

  1. It could not install any glass application on this simulated Glass. As Glass application source code mentions
  android:required="true" />
  1. When tried to run app by setting android:required (in manifest of hello world glass app)field to false for above uses-library, it gives another exception for class not found for classes of GDK.
  2. When tried another way to install app by adding gdk.jar from add-on from Android sdk setup, it gives another exception.

So even though this simulated glass is not much useful for glass development, but it definitely gives quick feel to Google glass if you just want to see how Glass works without paying for Google Glass.