Wednesday, November 8, 2017

Send image from Android Application and Save image to my server direct from php file

 Send image from Android Application use bellow code 
a.Get picture from android
$OutLet_Picture = $_REQUEST['OutLet_Picture'];
b.Check Image isEmpty
$image_name1 = "none";

if(!empty($OutLet_Picture)){
  @$base64Data1=$_REQUEST['OutLet_Picture'];
  @$binary1=base64_decode($base64Data1);
  $image_name1= $date_time2."1001"."1". ".jpg";
C.Save the Image
//Get the file
$image_path='/var/www/example.com/public_html/New_Images/'.$image_name1;
//$content = file_get_contents($binary1);
//Store in the filesystem.
$fp = fopen($image_path, "w");
fwrite($fp, $binary1);
fclose($fp); 



}

Save image to my server direct from php file


Copy image to my server direct from URL [duplicate]

1.Use bellow code.
//Get the file
$content = file_get_contents("http://www.google.co.in/intl/en_com/images/srpr/logo1w.png");
//Store in the filesystem.
$fp = fopen("/location/to/save/image.jpg", "w");
fwrite($fp, $content);
fclose($fp);
2. Send image from Android Application use bellow code
a.Get picture from android
$OutLet_Picture = $_REQUEST['OutLet_Picture'];
b.Check Image isEmpty
$image_name1 = "none";

if(!empty($OutLet_Picture)){
  @$base64Data1=$_REQUEST['OutLet_Picture'];
  @$binary1=base64_decode($base64Data1);
  $image_name1= $date_time2."1001"."1". ".jpg";
C.Save the Image
//Get the file
$image_path='/var/www/example.com/public_html/New_Images/'.$image_name1;
//$content = file_get_contents($binary1);
//Store in the filesystem.
$fp = fopen($image_path, "w");
fwrite($fp, $binary1);
fclose($fp); 

}


Sunday, October 8, 2017

barcode scanner in android programmatically

Simple Usage

1.) Add camera permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.CAMERA" />
2.) A very basic activity would look like this:
public class SimpleScannerActivity extends Activity implements ZXingScannerView.ResultHandler {
    private ZXingScannerView mScannerView;

    @Override
    public void onCreate(Bundle state) {
        super.onCreate(state);
        mScannerView = new ZXingScannerView(this);   // Programmatically initialize the scanner view
        setContentView(mScannerView);                // Set the scanner view as the content view
    }

    @Override
    public void onResume() {
        super.onResume();
        mScannerView.setResultHandler(this); // Register ourselves as a handler for scan results.
        mScannerView.startCamera();          // Start camera on resume
    }

    @Override
    public void onPause() {
        super.onPause();
        mScannerView.stopCamera();           // Stop camera on pause
    }

    @Override
    public void handleResult(Result rawResult) {
        // Do something with the result here
        Log.v(TAG, rawResult.getText()); // Prints scan results
        Log.v(TAG, rawResult.getBarcodeFormat().toString()); // Prints the scan format (qrcode, pdf417 etc.)

        // If you would like to resume scanning, call this method below:
        mScannerView.resumeCameraPreview(this);
    }
}

Tuesday, March 7, 2017

How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?

Easiest ways ever:

Update added for Android Studio V 2.2 in last step

There are two ways to do this.
1. Faster way:
  1. Open Android Studio
  2. Open your Project
  3. Click on Gradle (From Right Side Panel, you will see Gradle Bar)
  4. Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project)
  5. Click on Your Project (Your Project Name form List (root))
  6. Click on Tasks
  7. Click on Android
  8. Double Click on signingReport (You will get SHA1 and MD5 in Run Bar)
Check the screenshot below:
Enter image description here

Android Studio V 2.2 Update

There is an issue with Execution.
Solution:
  • Click on Toggle tasks execution/text mode from Run bar
Check Screenshot below:
enter image description here
Done.