Tag: Android

Display alarm manager entries of your app in Android

Unfortunately it's not possible to do this within the app itself as far as I know, but you can see it in a shell. In the below example I want to see all the alarm manager entries for my package my.package.name. The "when" field in my case is as Unix timestamp, so I rewrite it […]

Broadcast action on emulator

To emulate an action on an Android emulator, you can login into the shell and then broadcast some action. For e adb root adb shell am broadcast -a android.intent.action.BOOT_COMPLETED name.package.my

Firebase Cloud Messaging without google-services.json file

The default way to initialize Firebase in your Android app is to use the google-services.json file you can download from the firebase console. The content of this file will be automatically merged by gradle to initialize the FirebaseApp instance for your app. To manually initialize a FirebaseApp app, you can do the following (I replaced the real […]

Remove animation Android activity

By setting some style properties, you can remove the animation. <style name="ThemeWindowNoAnimation" parent="Theme.AppCompat.NoTitleBar.Fullscreen"> <item name="android:windowAnimationStyle">@null</item> <item name="android:windowEnterAnimation">@null</item> <item name="android:windowExitAnimation">@null</item> </style>

Change Android homeAsUpIndicator icon in Titanium

For a project I wanted to show a hamburger menu icon in the main screen that shows a navigation drawer. The steps I did: I manually enabled the displayHomeAsUp property of the ActionBar and handled the onHomeIconItemSelected event to show the navigation drawer: $.mainWindow.activity.actionBar.displayHomeAsUp = true; $.mainWindow.activity.actionBar.onHomeIconItemSelected = function() { onMenu(); }; And also replaced the "back" […]

Remove shadow Android ActionBar

If you want to remove the shadow below the ActionBar (for example in the AppCompat.Light theme), first create a style: <style name="ThemeActionBarWithoutShadow" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> <item name="elevation">0dp</item> <!--<item name="android:elevation">0dp</item>--> </style> And then reference it from within a theme: <style name="ThemeDefault" parent="Theme.AppCompat.Light"> <item name="colorPrimary">#F2E49F</item> <item name="colorPrimaryDark">#F2E49F</item> <item name="actionBarStyle">@style/ThemeActionBarWithoutShadow</item> </style>

Android emulator screenshot

A simple way to take screenshots of your Android emulator: adb shell /system/bin/screencap -p /sdcard/screenshot.png adb pull /sdcard/screenshot.png screenshot.png

Android nine patch

The left and top guidelines tell the framework what can be stretched, the right and bottom guidelines tell it which rows and columns are padding (actually, the area where the inner content can go).