Android Nougat Reply Notification Demo

Starting in Android 7.0 (API level 24) You have a lot of control, and you’re getting even more. Google has also done some cleanup to make all of those alerts look more refined and add in some color in the right places to make it easier to quickly see the most important information.

From the lock screen, you’ll notice the subtle aesthetic differences, but just as before you can swipe the away or tug down slightly to launch the Quick Reply. To type, you’ll need to unlock the device with the fingerprint reader, PIN, pass-code, or pattern.

With the new notification type introduce in Android 7.0 (Nougat) users can respond directly to text messages or update task lists from within the notification dialog. On a handheld, the inline reply action appears as an additional button displayed in the notification. A user replies via keyboard, the system attaches the text response to the intent you had specified for the notification action and sends the intent to your handheld app.

 

Lets  Get Started with Tutorial

  • Create an instance of RemoteInput.Builder that you can add to your notification action.

  •  Attach the RemoteInput

 

  • Apply the action to a notification

 

Above codes need sending notification.

Read text written on REPLY.

  • Query the bundle using the result key

 

  • Give another notification using the same notification ID that you provided for the previous notification. The progress indicator disappears from the notification interface to inform users of a successful reply.

 

Get full example source code on Github

Thank you for reading.

Control Smooth Scroll over Recycler View

In this post I will show you how can you achieve smooth scroll over RecyclerView

The key to a smoothly scrolling RecyclerView is to keep the application’s main thread (the UI thread) free from heavy processing. Recycler view is a flexible view for providing a limited window into a large data set.

Making Listview smooth there are many examples but none for the RecyclerView. Sometime its happen that user fling the screen so fast that RecyclerView looks shaky. It leave bad impression on the user.

For smooth scroll we need to control fling of the user. I have made custom class that extends RecyclerView. This can be achieve in just 3 steps.

Step 1 :

Create CustomRecyclerView Class. Below class is particular for Vertical RecyclerView.

For Horizontal RecyclerView just change fling method.

Step 2:

Because of we are using custom class for the RecyclerView we need to use class name with package name in the XML layout as well.

 

For example your create CustomRecyclerView under com.sid.views then in XML it will be com.sid.views.CustomRecyclerView

Step 3:

And the last step for reading custom class in the java. We need to use like that. This is TypeCasting to our Custom class.

 

You can get complete class from GitHub. For more information regarding smooth scroll go to this Question.

Thank you for Reading

 

Change Application name and launcher icon runtime.

Changing an application name and application icon from the application.

For that we need to use the <activity-alias>. This tag will be in manifest inside <application> tag.

An alias for an activity, named by the targetActivity attribute. The target must be in the same application as the alias and it must be declared before the alias in the manifest.

The alias presents the target activity as a independent entity. It can have its own set of intent filters, and they, rather than the intent filters on the target activity itself, determine which intents can activate the target through the alias and how the system treats the alias. For example, the intent filters on the alias may specify the “android.intent.action.MAIN” and “android.intent.category.LAUNCHER” flags, causing it to be represented in the application launcher, even though none of the filters on the target activity itself set these flags.

With the exception of targetActivity, <activity-alias> attributes are a subset of <activity> attributes. For attributes in the subset, none of the values set for the target carry over to the alias. However, for attributes not in the subset, the values set for the target activity also apply to the alias.

Source code Download Here

 

Secure Web-service Url in Android

This is serious problem that every one facing . How to secure Web-service URL if someone decompile the application.

Now a Days there are lots of tool that decompile the apk file and give possible java code. In code we have our Web-service url . Now that person have that url and get to know some important thing that we don’t want to disclose.

Even Using proguard it not Convert String resource to any secure resource.

So I research to that and have one idea that will help to secure our web-services.for that You will require only a single URL that call setup-url will setup all the stuff you want. I divide it in some steps.

Step 1 : Create Explicit Sqlite Database and insert your setup-url in any table and store it in asset folder.

Step 2 : At the Time of Execution store it in your data/data/your package/databases Location.

Step 3 : Now With Your java class File select that url from table.

Step 4 : Now while executing this web-service Pass one POST parameter as Token with it, Now at Web-service it will check first is the call is valid (Means from application) or Not. If yes then application will access the Url as response and then store it locally. If no then It will ask for token or redirect to the forbidden page.

Hope it will help to secure.

All other suggestion are welcome.

THANK YOU FOR READING

Use MD5 in android

One of the most important thing for password security is encryption of password.
For that everyone give suggestion of cipher but MD5 is better way to use.Because it is near to impossible to break MD5 code.

 

Just You need to pass String and it will return MD5 encrypted password

How to use proguard in android application ?

At Your project root you will find file named project.properties.

image1

now open this file you will find that proguard code is in comments.

proguard comment
proguard comment

remove this comments.
Now configure your proguard file available at same location under this guidance Proguard Configuration

Create your Proguard.cfg file.

In newer version you will find proguard-project.txt no need to worry simply write in project

proguard.config=proguard-project.txt

Enjoy !