Posts

Showing posts from 2016

FCM - Firebase cloud messanfing for Notification

Image
This post will cover step by step how to send a push notification from Firebase console to an app. What is push notification? Before digging into the details how to send notification in Android, it is useful to clarify what is a push notification. Using Android push notification, our app can notify a user of new events. This happens even if our app is not working in foreground. Using this service, we can send data from our server to our app whenever a new event occurs. This paradigm is much more efficient respect to keep on connecting to the server (pull method) to ask if there are new events. Using push notification, we can keep the user informed about events without draining the smartphone battery. When a user receives the notification, it appears, as a customized icon, in the status bar. There are different paradigm to use when sending a push notification:  Message to a single device  Message to a topic (send the same message to the multiple devices subscribed to a specif

Hide eye icon in edittext with password as input type while using material design

This issue is faced when you are using material design's edittext. Here, i am going to show you how to remove eye icon or right side of edittext with password as inputType. Add below line in parent view of xml layout xmlns: apps= "http://schemas.android.com/apk/res-auto" Add below line in TextInputLayout apps: passwordToggleEnabled = "false" it will looks like below : import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.mobileconnectors.s3.transferutility.TransferListener; import com.amazonaws.mobileconnectors.s3.transferutility.TransferObserver; import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; import com.amazonaws.mobileconnectors.s3.transferutility.TransferType; import com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility; import com.amazonaws.services.s3.AmazonS3Client; <android.support.design.widget.TextInputLayout android :id= "@+id/pin" android :layout_width= "

Create shapes online - Android Shapes Generator

Here, is the small online tool, which will help in creating drawable online. we just need to give background, border, border radius & some other details & this tool will provide you code for that.. Name of the tool is : Android Shapes Generator This small, Designer will help you save time and effort when designing interfaces for Android programs. Using visual tools to adjust the appearance and color. Then generate the xml code and use in your projects. In the future they are going to add collection of templates and themes. It's so easy, try it out. here, is the link : http://shapes.softartstudio.com/ This tool willl make your life easy and will save your time.... you can change code according your requirement... hurrryyyyyyyyyyyyyyy....................... Time is Money, so save it ;) Go for it...........

Amazon AWS s3 private Bucket video streaming

Amazon AWS s3 private bucket video streaming is so simple.. Add below permission in menifeast : < uses-permission android :name = " android.permission.INTERNET " /> Add below dependency in gradle file : compile ' com.amazonaws:aws-android-sdk-s3:2.3.0 ' Write below code lines to get private streaming url to stream video : AWSCredentials myCredentials = new BasicAWSCredentials ( {AWS_ACCESS_KEY_ID} , {AWS_SECRET_KEY} ); AmazonS3 s3client = new AmazonS3Client (myCredentials); s3client. setEndpoint ( {AWS_END_POINT} ); GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest ( {AWS_BUCKET} , {AWS_KEY} ); URL objectURL = s3client.generatePresignedUrl(request); Uri url = Uri.parse(objectURL.toString()); Initialize media controller & play video in video view VideoView mContentView = ( VideoView ) findViewById(R.id.surface); MediaController mController = new MediaController (this); mController. setAnchorView (mContentView); mCon

Download file from Amazon AWS private Bucket

Download file from AWS S3 private Bucket Amazon is providing many of the APIs, all are used in different scenarios, Here, our aim is to download file using Amazon API, for that amazon's AWS S3 from SDK is used. Add below dependency in your app's gradle file compile 'com.amazonaws:aws-android-sdk-s3:2.3.0' below are the classes you need to import import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.mobileconnectors.s3.transferutility.TransferListener; import com.amazonaws.mobileconnectors.s3.transferutility.TransferObserver; import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; import com.amazonaws.mobileconnectors.s3.transferutility.TransferType; import com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility; import com.amazonaws.services.s3.AmazonS3Client; Declare Below variables in your class private static AmazonS3Client sS3Client; private static AWSCredentials

How to put a watch in Android Studio?

Image
How to put a watch(see how a variable is modified) in Android Studio? Some times small things are also so much important Let's have a look.. Start by putting a break point in the class where you'd want to watch a specific variable. Run the code and once it hits your breakpoint from the Variables window frame you should see all of the variables that are accessible. Simply choose the one you'd want to watch and then right click and choose "Add to watches" from the drop-down. Keep debugging and you should see the variable from the Watches window frame update when appropriate based on your code.

Read sms automatically to verify OTP

Reading incoming message automatically in android to verify OTP Here I am going to explain how to read the incoming message in android automatically to verify OTP without  closing the app. Step 1. Read Sms . class import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsManager; import android.telephony.SmsMessage; import android.util.Log; public class ReadSms extends BroadcastReceiver { @Override public void onReceive ( Context context, Intent intent) { final Bundle bundle = intent.getExtras(); try { if (bundle != null) { final Object[] pdusObj = ( Object[] ) bundle.get("pdus"); for ( int i = 0; i < pdusObj.length; i++) { SmsMessage currentMessage = SmsMessage.createFromPdu((byt

Runtime Permissions - Marshmallow OS Android

Image
Automatically granted permissions There is some permission that will be automatically granted at install time and will not be able to revoke. We call it  Normal Permission  (PROTECTION_NORMAL). Here is the full list of them: android.permission.ACCESS_LOCATION_EXTRA_COMMANDS android.permission.ACCESS_NETWORK_STATE android.permission.ACCESS_NOTIFICATION_POLICY android.permission.ACCESS_WIFI_STATE android.permission.ACCESS_WIMAX_STATE android.permission.BLUETOOTH android.permission.BLUETOOTH_ADMIN android.permission.BROADCAST_STICKY android.permission.CHANGE_NETWORK_STATE android.permission.CHANGE_WIFI_MULTICAST_STATE android.permission.CHANGE_WIFI_STATE android.permission.CHANGE_WIMAX_STATE android.permission.DISABLE_KEYGUARD android.permission.EXPAND_STATUS_BAR android.permission.FLASHLIGHT android.permission.GET_ACCOUNTS android.permission.GET_PACKAGE_SIZE android.permission.INTERNET android.permission.KILL_BACKGROUND_PROCESSES android.permission.MODIFY_AUD