Prash's Blog

Basic Patterns for Mobile Navigation September 12, 2016

Filed under: Android — prazjain @ 1:14 pm
Tags: , ,

https://uxplanet.org/basic-patterns-for-mobile-navigation-d12a87686efe

 

 

 

Insufficient Storage Space Available on Android when installing apps June 27, 2014

Filed under: Android — prazjain @ 5:39 pm

I tried quite a few things like uninstalling apps, moving apps to SD card but this error keeps coming back.
Here is what worked for me:


Open the Phone app and switch to Keypad.
Dial *#9900#
On the screen that appears, click on the button labelled "Delete dumpstate/logcat".

 

How to show message count on app icon in Android June 6, 2014

Filed under: Android — prazjain @ 9:08 pm
Tags:

I was curious about how whatsapp and facebook showed a count of unread messages or notifications on app icon in Android, and I wanted to find that out for myself.

It is explained well in the link below.


//This is for samsung touchwiz

public static void setBadge(Context context, int count) {
    String launcherClassName = getLauncherClassName(context);
    if (launcherClassName == null) {
        return;
    }
    Intent intent = new Intent("android.intent.action.BADGE_COUNT_UPDATE");
    intent.putExtra("badge_count", count);
    intent.putExtra("badge_count_package_name", context.getPackageName());
    intent.putExtra("badge_count_class_name", launcherClassName);
    context.sendBroadcast(intent);
}

public static String getLauncherClassName(Context context) {

    PackageManager pm = context.getPackageManager();

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);

    List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, 0);
    for (ResolveInfo resolveInfo : resolveInfos) {
        String pkgName = resolveInfo.activityInfo.applicationInfo.packageName;
        if (pkgName.equalsIgnoreCase(context.getPackageName())) {
            String className = resolveInfo.activityInfo.name;
            return className;
        }
    }
    return null;
}

Sony devices use a class named BadgeReciever.
Declare the com.sonyericsson.home.permission.BROADCAST_BADGE permission in your manifest file:
Broadcast an Intent to the BadgeReceiver:

Intent intent = new Intent();

intent.setAction("com.sonyericsson.home.action.UPDATE_BADGE");
intent.putExtra("com.sonyericsson.home.intent.extra.badge.ACTIVITY_NAME", "com.yourdomain.yourapp.MainActivity");
intent.putExtra("com.sonyericsson.home.intent.extra.badge.SHOW_MESSAGE", true);
intent.putExtra("com.sonyericsson.home.intent.extra.badge.MESSAGE", "99");
intent.putExtra("com.sonyericsson.home.intent.extra.badge.PACKAGE_NAME", "com.yourdomain.yourapp");

sendBroadcast(intent);

Done. Once this Intent is broadcast the launcher should show a badge on your application icon.

To remove the badge again, simply send a new broadcast, this time with SHOW_MESSAGE set to false:


intent.putExtra("com.sonyericsson.home.intent.extra.badge.SHOW_MESSAGE", false);

More details in the links below

stackoverflow.com how-to-display-count-of-notifications-in-app-launcher-icon

android-notification-badge-app-icon-sony/

 

Android browser home page hijacked by searchmobileonline.com September 8, 2012

Filed under: Android — prazjain @ 10:30 am
Tags: , , ,

I got my Android browser home page hijacked by searchmobileonline.com. I traced it to installing a random app “Remote Gallery 3d” I found on a blog. This app also created a shortcut “Search” in my android shortcut panel.
This is how I got rid of it, hope it will help you too.
1) Remove “Search” from the shortcut panel in android.
2) Go to Settings -> Applications -> All -> Internet.
3) Clear cache data and clear data.
4) Restart Android browser to check.

 

Android app Flight Flash on Google Play now! May 22, 2012

Filed under: Android — prazjain @ 1:26 am
Tags:

Just released my second android app Flight Flash on Google Play. https://play.google.com/store/apps/details?id=com.jainpraz.apps.flightflash

https://market.android.com/details?id=com.jainpraz.apps.flightflash

Flight Flash gives you latest and up to date information on flight arrivals and departures from your city airport.
It supports both domestic and international flights.
Currently available for India and UK.
Supported cities in India : Bangalore, Chennai, Mumbai, New Delhi.
Supported airports in UK : London Heathrow, London Stansted, London Gatwick, London City Airport, London Luton.

Let me know if you like to see your favourite city or airport added to the list.

 

Removing HtmlUnit logs April 25, 2012

Filed under: Android — prazjain @ 6:46 pm
Tags: ,

HtmlUnit outputs a lot of logs on the console, and when my app was running for a few days straight, the log file size got huge and most of it was htmlunit log. I got rid of all the INFO logs, and all the WARNING logs were due to javascript error in the websites, so I set it to SEVERE.

In tomcat home directory, find logs/logging.properties file and add the following bits


org.apache.http.level = INFO
com.gargoylesoftware.htmlunit.level = SEVERE
com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter.level = OFF
com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject.level = OFF
com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument.level = OFF
com.gargoylesoftware.htmlunit.html.HtmlScript.level = OFF

 

How to setup android emulator display for a phone

Filed under: Android — prazjain @ 11:41 am
Tags: , ,

I was facing a similar problem some time back, when I was writing an android app, and wanted to test it in the emulator with the display settings of the phone.

This is how I set up android emulator for samsung galaxy s2.

  • In Eclipse, go to Windows to start AVD Manager.
  • Select the AVD that you have created already, and click on edit.

  • Set resolution to 480 * 800. Click Edit AVD.

  • Click on Start. Select Scale display to real size. Set screen size to 4.3. For monitor dip, click on the “?”, enter your monitor’s Screen size and select its current resolution. Click ok. Click Launch.