Skip to main content

Posts

De-obfuscate the stack trace using Proguard GUI  Store the Proguard mapping.txt file for each released APK, which will be useful to de-obfuscate crash or exception stack trace. Steps to retrace :- 1. Go to your SDK location -> Android_SDK\adt-bundle-windows-x86-20131030\sdk\tools\proguard\bin folder 2. Run retrace.bat file , choose "Retrace" option. 3. Add your proper mapping.txt 4. And paste the dumped stack trace , stack trace should be from "at" on each line 5. Proguard will replace all method and class names according to the mapping file.

Launching Android application from web browser

Steps to follow :- 1. Define an activity in android manifest file with below intent filters :-    <activity             android:name=".LaunchActivityFromBrowser"             android:configChanges="orientation|keyboardHidden|fontScale|locale|layoutDirection|screenSize|screenLayout|mnc|mcc|navigation"             android:launchMode="singleTask"             android:screenOrientation="portrait"             android:theme="@android:style/Theme.Black.NoTitleBar" >             <intent-filter>                <action android:name="android.intent.action.VIEW" />                 <category android:name="android.intent.category.DEFAULT" />                 ...

Get Android application version information programatically in android

Reading Android application version name and version code defined in the Manifest file programatically in android              /**      * Method to Fetch Application Name as Defined in Manifest File      * @returns String      */     public String getVersionName(){         String versionName = "";         try {                 versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;         } catch (Exception e) {             e.printStackTrace();         }         return versionName;     }         /**     ...

Supporting text size for all supporting devices for your Android Application

Add different dimens.xml files to support different font sizes for all supporting devices in your application.. First create different folders as below, Under res folder create folders as , res/values/dimens.xml(default) res/values-ldpi/dimens.xml (for ldpi devices) res/values-mdpi/dimens.xml res/values-hdpi/dimens.xml res/values-xhdpi/dimens.xml   res/values-xxhdpi/dimens.xml For Tablets , res/values-sw600dp/dimens.xml (600*1024) res/values-sw720dp-land/dimens.xml (800*1280) Now Update dimens.xml for defining font sizes dimens.xml file should have text size defined for all labels as below, eg. Default value of footer text size will be 18 sp,  <dimen name="text_size_footer">18sp</dimen> eg. For tablet -> res/values-sw600dp value of footer textsize will be 25 sp,  <dimen name="text_size_footer">25sp</dimen> Finally read it in a your layout, <TextView     android:id="@+id/lblFooter" ...

Bring Android application to forground

Intent launchApp = new Intent(context, Applications_MainActivity.class);                             launchApp.setAction(Intent.ACTION_MAIN);                             launchApp.addCategory(Intent.CATEGORY_LAUNCHER);                             launchApp.setFlags(IConstants.NOTIFICATION_FLAG);//Use this Special Flag                             context.getApplicationContext().startActivity(launchApp); Update below value in your Constants File,   public static final int NOTIFICATION_FLAG = 0x10200000;

IS MY SERVICE RUNNING? - DISPLAY ALL RUNNING SERVICES IN ANDROID

Compare your service name with class name of running services to find out your service is running or not. ActivityManager activityManager= (ActivityManager)getSystemService(ACTIVITY_SERVICE);         for (RunningServiceInfo service : activityManager.getRunningServices(Integer.MAX_VALUE)) {             Log.i("Service", "Process " + service.process + " with component " + service.service.getClassName());         }