Posts

Showing posts from August, 2016

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