Android N Java8 java.time

java.time package was added only in API 26 (Android O): https://developer.android.com/reference/java/time/package-summary.html UPDATE Starting with version 4.0 of the Android Gradle Plugin, you can use a subset of java.time APIs (along with a number of other Java 8 language APIs) without requiring a minimum API level for your app: https://developer.android.com/studio/write/java8-support#library-desugaring The following set of APIs are … Read more

In Android 7 (API level 24) my app is not allowed to mute phone (set ringer mode to silent)

Thanks for your answers, here is a little more detail. To be able to set ringer mode to silent, you must ask permission to access notification policy (like @ucsunil said). <uses-permission android:name=”android.permission.ACCESS_NOTIFICATION_POLICY” /> Then, check if you have this permission. If you do not, open the settings for “Do Not Disturb access” for your app: … Read more

Expand/Collapse Lollipop toolbar animation (Telegram app)

Edit : Since the release of the Android Design support library, there’s an easier solution. Check joaquin’s answer — Here’s how I did it, there probably are many other solutions but this one worked for me. First of all, you have to use a Toolbar with a transparent background. The expanding & collapsing Toolbar is … Read more

Job Scheduler not running on Android N

In Android Nougat the setPeriodic(long intervalMillis) method call makes use of setPeriodic (long intervalMillis, long flexMillis) to schedule periodic jobs. As per the documentation: JobInfo.Builder setPeriodic (long intervalMillis, long flexMillis) Specify that this job should recur with the provided interval and flex. The job can execute at any time in a window of flex length … Read more

How to get charles proxy work with Android 7 nougat?

The solution is do not use .p12, just navigate with Chrome (with configured proxy on wifi) to http://charlesproxy.com/getssl and install downloaded .pem file. I had exactly the same problem on my Nexus 5X running Android 7.0. There was previously exported .p12 from Charles 3.11.5 (Help->SSL Proxying->Export Charles Root certificate and Private key). When I tried … Read more

Replacing default Phone app on Android 6 and 7 with InCallService

The app compiles fine but Default Apps in settings doesn’t show my app. To have your app listed as a Phone app, you must have an activity with at least those intent filters (to handle both cases mentioned in documentation of ACTION_DIAL, also mentioned in DefaultDialerManager hidden class): <intent-filter> <action android:name=”android.intent.action.DIAL” /> <data android:scheme=”tel” /> … Read more

Detect CONNECTIVITY CHANGE in Android 7 and above when app is killed/in background

Nougat and Above: We have to use JobScheduler and JobService for Connection Changes. All I can divide this into three steps. Register JobScheduler inside activity. Also, Start JobService( Service to handle callbacks from the JobScheduler. Requests scheduled with the JobScheduler ultimately land on this service’s “onStartJob” method.) public class NetworkConnectionActivity extends AppCompatActivity { @Override protected … Read more