Skip to main content

Get ready for the Android Nougat and update your application

Multi-window 

A new manifest attribute called android:resizableActivity is available for apps targeting N and beyond. If this attribute is set to true, your activity can be launched in split-screen modes on phones and tablets. 
You can also specify your activity's minimum allowable dimensions, preventing users from making the activity window smaller than that size.

Implementation:

<activityandroid:name=“ActivityName” android:configChanges="orientation|screenSize|keyboard|keyboardHidden|screenLayout|smallestScreenSize"android:resizeableActivity="true”></activity>

Direct reply notifications: 

With Android Nougat, you can reply to your notifications directly from their spot in the tray. You won't have to open the app or install anything extra, either. Once the folks who built your app support the feature, it will just work.
Don't worry though. When you need to see more or do more than just send a quick reply, you can still tap the notification to open an app and see everything. And with better bundling of multiple notifications from the same app, you'll be able to tell when you need to see everything even easier.

The RemoteInput notification API, which was originally added for Android Wear, now works in N for phones and tablets. 
Using the RemoteInput API enables users to reply to incoming message notifications quickly and conveniently, without leaving the notification shade.

Implementation:


Battery Save:

Google's "Project Doze" — its code name for ways to have your phone use less battery while it's not in your hands with the screen on — that was introduced with Marshmallow has gotten a major update in Nougat. While it previously worked great while the phone was sitting still and not plugged in, now it works while it's in your pocket or purse. How it does it hasn't changed much; once your phone's screen has been off for a while, it stops doing things in the background all the time, and instead uses what Google calls "windows" to check for new messages or do things like update your location.












Using less mobile data:

Overage charges from your phone company suck. With Android Nougat new tools can help keep them from happening.
When you're on a metered connection (one that's not unlimited) — cellular or Wi-Fi — the new Data Saver setting can block background random data usage and restrict things like checking for tweets or emails so that your phone uses less data.
You can tell Data Saver to ignore certain apps, and while it's active you'll have an icon in your notifications to let you know what's up.


More human emoji:

In addition to 72 new glyphs, Android 7.0 has over 1,500 emoji, many of which have been revamped to look a bit more. human. 
Traditionally, Android emoji have been cartoony, which has encouraged other manufacturers like Samsung and LG to write their own.

Improved security:

Keeping your data private and personal is important. New features in Android Nougat make things even more secure.
When you start your phone, some apps are able to partially work before you sign in with your password or PIN. Things like the actual phone app or your text messages can still come in, your alarm will still work and any accessibility features needed to better interact with your phone can still run. Other apps and their data will remain unavailable and/or encrypted.
Once you sign in, everything will work normally.
This feature helps keep your data safe if your phone gets lost or stolen, and synergizes well with the remote features of Android Device Manager.

Language and locale

If you have your phone set for a specific region — let's say the French-speaking portion of Switzerland — your phone will now try to use a similar region setting if it can't find a specific match. In our example, that means an app can display text and numerical data for standard French instead of just using the default language settings if Swiss localization wasn't included.
You can also select multiple languages (or regionalizations of the same language) in an order of importance — if an app you're using is localized for multiple languages you'll see your top pick — if it's set up for one but not all of your languages, it'll pick the highest one it can.

Android TV recording and Picture-in-Picture

Basic DVR functionality is coming to Android TV with 7.0. Besides basic controls like Play or Rewind, you'll be able to save multiple sessions. This means you can schedule recordings or record as you watch.
This should be a great feature for Televisions that come with Android TV installed.


If you are using camera in app and you already updated app target version to 24 your app crashes.

Solution:

file:// scheme is now not allowed to be attached with Intent on targetSdkVersion 24 (Android Nougat). And here is the solution.

> Android API target should improve to 24 
>  If your targetSdkVersion is 24 or higher, we have to use FileProvider class to give access to the particular file or folder to make them accessible for other apps. 

Add a FileProvider tag in AndroidManifest.xml under tag. 


<?xml version="1.0" encoding="utf-8"?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"    ...    <application        ...        
<provider            
android:name="android.support.v4.content.FileProvider"            
android:authorities="${applicationId}.provider"           
android:exported="false"            
android:grantUriPermissions="true">           
 <meta-data                
android:name="android.support.FILE_PROVIDER_PATHS"     
android:resource="@xml/provider_paths"/>     
  </provider>   
 </application>
</manifest>

then create a provider_paths.xml file in xml folder under res folder. Folder may be needed to create if it doesn't exist. The content of the file is shown below. It describes that we would like to share access to the External Storage at root folder (path=".") with the name external_files



<?xml version="1.0" encoding="utf-8"?> 
<paths xmlns:android="http://schemas.android.com/apk/res/android">    
<external-path name="external_files" path="."/>
</paths>

The final step is to change the line of code below in

Uri photoURI = Uri.fromFile(createImageFile());

to

Uri photoURI = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", createImageFile());


Please update if anything need to be addressed here.

Latest Update:



Thank you..

Comments

Popular posts from this blog

Google re-branded the support Android libraries to AndroidX

It is important to note, you cannot mix AppCompat and Jetpack in the same project. You must convert everything to use Jetpack if you want to upgrade. The support library artifacts are being deprecated and all future development is going into AndroidX , so there's no avoiding this migration. Alan Viverette sums this up nicely: “There won’t be a 29.0.0, so Android Q APIs will only be in AndroidX” The stable release of 28.0.0 will be the final feature release packaged as android.support . All subsequent feature releases will only be made available as androidx-packaged artifacts. Below tips will give you a clearer transition path. The current version of AppCompat (v28.x) is exactly the same as AndroidX (v1.x). In fact, the AppCompat libraries are machine generated by changing maven coordinates and package names of the AndroidX codebase. For example, android.support.v7.app.AppCompatActivity is now androidx.appcompat.app.AppCompatActivity For a complete listi

Android Beginners Guide

                                                                                                               Android Operation System: Android is an operating system based on Linux with a Java programming interface. It provides tools, e.g. a compiler, debugger and a device emulator as well as its own Java Virtual machine (Dalvik Virtual Machine - DVM). Android is created by the Open Handset Alliance which is lead by Google. Android uses a special virtual machine, e.g. the Dalvik Virtual Machine. Dalvik uses special bytecode. Therefore you cannot run standard Java bytecode on Android. Android provides a tool "dx" which allows to convert Java Class files into "dex" (Dalvik Executable) files. Android applications are packed into an .apk (Android Package) file by the program "aapt" (Android Asset Packaging Tool) To simplify development Google provides the Android Development Tools (ADT) for Eclipse. The ADT performs automatically the conversion f

Android Pi migration(28 API support)

I am here to give some inputs on android PI migration. .  Apps must target at least API level 28 to ensure it is built on the latest APIs optimized for security and performance . From August 2019, new apps must target at least Android 9.0 (API level 28) . The objective here is to make sure that your existing app works as-is on Android 9. Because some platform changes might affect the way your app behaves, some adjustments might be necessary, but you do not need to use new APIs or change your targetSdkVersion. Android Service Problem On Oreo, startService() will throw IllegalStateException. This can be fixed by changing it to startForegroundService(). but it also stops the service immediately if you don’t bind to the Notification with Service.startForeground() within 5 seconds. For other background service we decided to use the WorkManager . Implementation: Since we have minSdkVersion 19, We migrated to workmanger for scheduled tasks and we still use JobIntentSer