android-5.1.1-lollipop

Call third party app Activity from own App

隐身守侯 提交于 2019-12-25 08:42:50
问题 I have successfully called third party apps from my app Apps like: Google Drive and Google Photos Code: btnL1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openApp(KioskActivity.this, "com.google.android.apps.docs"); } }); btnL2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openApp(KioskActivity.this, "com.google.android.apps.photos"); } }); public static boolean openApp(Context context, String

Detect which app has been launched in android

China☆狼群 提交于 2019-12-24 00:49:16
问题 How to detect which app has been launched by user in my app i.e my application should get notified when Whatsapp is launched by user even if my app is not running in foreground or background. hike messenger has achieved same functionality with accessibility service. How can I solve this problem ? Thanks in advance!! 回答1: Depending on the Android version running your application, you will have to use different methods. On Pre-Lollipop devices, it is pretty straight-forward: String[] result =

Running dpm with Runtime.exec(…)

ε祈祈猫儿з 提交于 2019-12-23 17:27:02
问题 This answer suggests that an Android app can run dpm like this: Runtime.getRuntime().exec("dpm set-device-owner com.test.my_device_owner_app"); This fails silently on my Nexus 4 running 5.1.1. The shell returns an error code of 0 (success) and there is no console output. Despite the apparent success, my app does not become the device owner. The device is fresh from a factory reset, with no user account configured. As a control, I tried running a garbage command instead of dpm . It fails as

How to use Android's Sensor Batching without AlarmManager

拟墨画扇 提交于 2019-12-23 17:19:05
问题 I want to use Androids sensor batching introduced in Android 4.4 to save some battery power. My testing device can store 184 sensor events in its fifo-queue. Using a sampling rate of 18 events/seconds I have to flush the sensor about every 10 seconds. The section on Sensor Batching in the 4.4 Documentation proposes: Use that calculation to set wake alarms with AlarmManager that invoke your Service (which implements the SensorEventListener) to flush the sensor. Since Android 5.1 the minimum

Content Transitions on Top of Shared Elements in android

可紊 提交于 2019-12-22 08:59:32
问题 I am trying my hands with SharedElements and Content Transitions in Android. I was trying to combine Content Transitions and Shared Elements and create a particular animation, however I have encountered a problem. After the transition on Shared Elements (ImageView) end, I am using content Transitions to animate Text View into position using Slide Transition. However when the textViews are sliding from Bottom to their position on the top of image View, the text goes beneath the ImageView

Changing all typefaces of an android application [duplicate]

蓝咒 提交于 2019-12-22 08:27:48
问题 This question already has answers here : Is it possible to set a custom font for entire of application? (25 answers) Closed 11 months ago . How can I change the entire typeface of my android application? previously I saw this post on github.The solution work fine only for devices with lower than api 21. For android 5 this method doesn't work even if we add a values-v21 folder with styles.xml separately. This is my values-v21/styles.xml : <resources> <style name="AppBaseTheme" parent="Theme

Android app time delay on 5.0+ devices

…衆ロ難τιáo~ 提交于 2019-12-22 01:32:41
问题 My app is taking 10-12 sec delay while first load on 5.0+ devices, 4.4 or below devices does not have this problem. I have added a log message in Application class onCreate method but it is also called after 10-12 sec seconds. I have tried multidex enable false, minify enabled true but does not make any difference. I have found one thing, when we clear cache and data from app info activity, then it again delay while loading and my app is taking around 10mb of cache and 5 mb of data which is

Creating A Digital Clock Widget With A Custom Font

流过昼夜 提交于 2019-12-18 14:57:21
问题 I'm trying to create a digital clock widget with a custom font. And this has proven to be the biggest challenge of my Android experience. (Thought it would be as simple as tc.setTypeFace("whatever") and be done with it) The best way seems to be scratch the TextClock and use an ImageView and pass a Bitmap to it using a custom AlarmManager to create a new image for the view each second. Before I get into the Bitmap generation, I practiced on a simple TextView using this tutorial Alarm Manager

Android MediaCodec Encode and Decode In Asynchronous Mode

此生再无相见时 提交于 2019-12-18 10:29:22
问题 I am trying to decode a video from a file and encode it into a different format with MediaCodec in the new Asynchronous Mode supported in API Level 21 and up (Android OS 5.0 Lollipop). There are many examples for doing this in Synchronous Mode on sites such as Big Flake, Google's Grafika, and dozens of answers on StackOverflow, but none of them support Asynchronous mode. I do not need to display the video during the process. I believe that the general procedure is to read the file with a

onTagDiscovered() not called any more when nfc tag already there after updating from 4.4.4 to 5.1.1 Samsung

╄→гoц情女王★ 提交于 2019-12-13 19:35:28
问题 I had a code able to detect an already present NFC tag when I start my NFCadapter. Which is very nice since it means you don't need to move the tag to detect and read it :) Since I update a Samsung phone to 5.1.1 form 4.4.4, this is not working any more. Moving the tag to close contact does fire onTagDiscovered() but it used to be fire instantly. AFAIK, Google changes around NFC should not have impacted my workflow : http://developer.android.com/sdk/api_diff/21/changes.html displays only