Posts

Showing posts from November, 2013

Some thoughts about AppOpsManager and 4.4

Image
Android 4.3 introduced a new hidden feature: AppOps. Android 4.4 improved this feature, but it is still hidden. Someone talks about it as an "App Permission Manager". We have very few information about it, but it is a lot more than a simple permission manager. Currently there is no action to launch it. You can see it in Manifest.xml: https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml#L802 A simple way could be this: Intent intent = new Intent("android.settings.SETTINGS"); intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, "com.android.settings.applications.AppOpsSummary"); startActivity(intent); Here you can find info about apps which use location-permissions, contact-permissions, message-permissions.... In the list, for each app you can see the last use of this permission, and if you click on an item, you can see a full detail. Pay attention! You can disable permi

NotificationListenerService and kitkat

Image
Android 4.3 (API 18) introduced NotificationListenerService . I published a post about it a few months ago. Android 4.4 (API 19) added new features, and now we can have a lot of extra info about a notification (before we need to use reflection to read some info). As in 4.3,to use the NotificationListenerService we have to extend the NotificationListenerService and implement onNotificationPosted() and onNotificationRemoved() methods public class SimpleKitkatNotificationListener extends NotificationListenerService { @Override public void onNotificationPosted(StatusBarNotification sbn) { //.............. } @Override public void onNotificationRemoved(StatusBarNotification sbn) { //.............. } } Then we must declare the service in the manifest file with the BIND_NOTIFICATION_LISTENER_SERVICE permission and include an intent filter with the SERVICE_INTERFACE action

Common tips about Gradle - part 2

In my previous post I wrote some common gradle tips. In this post I will continue to collect other common (and basic) cases. I would like to use the Eclipse folders structure in Android Studio. How to achieve that? In your build.gradle you can set this script: android { sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } } } Where should I create the libs folder for my jars file? You can use this structure: - root - project libs myjar.jar src main java res build.gradle In build.gradle: dependencies { compile files('libs/myjar.jar') } Where should I create the aidl