Simplest way to make call recording android mobile app

A recording is one of the most useful features in Android mobile phones because with the use of this feature Android application users can easily record their voices as audio notes and play them whenever they want to. So in this tutorial, we are going to Simplest way to make call recording android mobile app. Example Tutorial will work on any Android platform without any error.

Ever wished you had recorded a call? Maybe you got bad customer service from a company over the phone and you want proof. Or, maybe you received training or help that you want to reference again in the future.

There are ways to make call recording Android phone. We will show you an app that records both sides of a conversation on your Android phone with the ability to automatically start when you make or receive a phone call. We’ll also show you an app that allows you to record any sounds outside the phone, allowing you to record both sides of a call.

The Android multimedia framework includes support for capturing and encoding a variety of common audio and video formats. You can use the MediaRecorder APIs if supported by the device hardware.

This document shows you how to use MediaRecorder to write an application that captures audio from a device microphone, save the audio, and play it back (with MediaPlayer). To record video you’ll need to use the device’s camera along with MediaRecorder. This is described in the Camera guide.

To be able to record, your app must tell the user that it will access the device’s audio input. You must include this permission tag in the app’s manifest file:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

Make call recording android mobile app

RECORD_AUDIO is considered a “dangerous” permission because it may pose a risk to the user’s privacy. Starting with Android 6.0 (API level 23) an app that uses a dangerous permission must ask the user for approval at run time. After the user has granted permission, the app should remember and not ask again. The sample code below shows how to implement this behavior using ActivityCompat.requestPermissions().

MediaRecorder recorder;
private boolean startMediaRecorder(final int audioSource){
    recorder = new MediaRecorder();
    try{
        recorder.reset();
        recorder.setAudioSource(audioSource);
        recorder.setAudioSamplingRate(8000);
        recorder.setAudioEncodingBitRate(12200);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        String fileName = audiofile.getAbsolutePath();
        recorder.setOutputFile(fileName);

        MediaRecorder.OnErrorListener errorListener = new MediaRecorder.OnErrorListener() {
            public void onError(MediaRecorder arg0, int arg1, int arg2) {
                Log.e(TAG, "OnErrorListener " + arg1 + "," + arg2);
                terminateAndEraseFile();
            }
        };
        recorder.setOnErrorListener(errorListener);

        MediaRecorder.OnInfoListener infoListener = new MediaRecorder.OnInfoListener() {
            public void onInfo(MediaRecorder arg0, int arg1, int arg2) {
                Log.e(TAG, "OnInfoListener " + arg1 + "," + arg2);
                terminateAndEraseFile();
            }
        };
        recorder.setOnInfoListener(infoListener);


        recorder.prepare();
        // Sometimes prepare takes some time to complete
        Thread.sleep(2000);
        recorder.start();
        isRecordStarted = true;
        return true;
    }catch (Exception e){
        e.getMessage();
        return false;
    }
}

You can define audio source as per the device also. Different devices allow the media recorder for different audio sources.

public static int getAudioSource(String str) {
    if (str.equals("MIC")) {
        return MediaRecorder.AudioSource.MIC;
    }
    else if (str.equals("VOICE_COMMUNICATION")) {
        return MediaRecorder.AudioSource.VOICE_COMMUNICATION;
    }
    else if (str.equals("VOICE_CALL")) {
        return MediaRecorder.AudioSource.VOICE_CALL;
    }
    else if (str.equals("VOICE_DOWNLINK")) {
        return MediaRecorder.AudioSource.VOICE_DOWNLINK;
    }
    else if (str.equals("VOICE_UPLINK")) {
        return MediaRecorder.AudioSource.VOICE_UPLINK;
    }
    else if (str.equals("VOICE_RECOGNITION")) {
        return MediaRecorder.AudioSource.VOICE_RECOGNITION;
    }
    else if (str.equals("CAMCORDER")) {
        return MediaRecorder.AudioSource.CAMCORDER;
    }
    else {
        return MediaRecorder.AudioSource.DEFAULT;
    }
}

NOTE: Recording a phone call without the knowledge of one or both of the parties is illegal in some countries. Some states in the United States require one party to be notified of the recording, some require both parties to be notified. For more information about laws regarding call recording, see Wikipedia and the Digital Media Law Project. Be sure to do your due diligence about the laws in your state before recording any calls.

Conclusion

Jiyo analyses all voice calls in a sales cycle to enhance sales- agent performance and sales conversion ratio. When a salesperson completes a call, call log and the corresponding recording is integrated to the CRM system. The software automatically generates various reports for future analysis of sales agent’s performance. Analysis of call recording android phone helps in improving the sales pitch and product based on customer feedback which leads to higher sales/sales person.

magento-logoJiyo Agent
Jiyo Agent, our native Android app, is a free call recorder application. Calls are automatically recorded and saved to Jiyo. Also all the incoming, outgoing and missed calls details can be viewed inside the app.

References

  • Media Recorder: Media Recorder Documentation for Developers
  • Sales Performance: Sales- agent performance and sales conversion ratio Product pricing and all information

Further reading:

Ultimate Magento 1 Developer Guide : How to get product details using rest API in Magento 1.x ?

Future is mobile apps. Especially, eCommerce Mobile Apps. Sooner or later you’ll run into a case where you need REST API for your online store and you found that Magento does not support all Magento REST API. What should you do now? How can you write REST API for your online store as per client need?

The Magento REST API allows you to use various data entities such as customer, catalog and order information to third-party applications. I’d like to share it with you a quick, simple, well written and easy solution which will explain how can you retrieve the product details with the help of REST API.

You are working on a mobile application and want to display product after customer selected a category. You are able to get the list of the product by category in REST API request but that list doesn’t have many details about the product and you want to show more product details to the users. What should you do to get more product information so that you can show the image and other things in a mobile app?

Magento Rest API for Product Details by SKU

Step 1: Get the SKU which you need to get the product details.

      $sku  =  $this->getRequest()->getParam('SKU');

Step 2: Load the product using the product SKU. We can also load product by its attributes, like SKU, Id. Assuming product SKU to be ‘1000’.

    
       // Mage main object
	$catalogMageObj = Mage::getModel('catalog/product');
	$products = $catalogMageObj->loadByAttribute('sku', $sku);

Step 3: load the product custom attributes details.

	$custom_attributes = array();
	$attributes = $products->getAttributes();
	foreach ($attributes as $attribute) {
		if ($attribute->getAttributeCode() =="category_ids"){
			$custom_attributes[] = array(
				"attribute_code"=> $attribute->getAttributeCode(),
				"value"=> $products->getCategoryIds()
			);
		}
		else{
			$custom_attributes[] = array(
				"attribute_code"=> $attribute->getAttributeCode(),
				"value"=> $attribute->getFrontend()->getValue($products)
			);
		}
	}

Step 4: Create and return the full array of the loaded product.

	
protected function getProductDetailsBySku()
{
        $sku  =  $this->getRequest()->getParam('sku');	

        // Mage main object
	$catalogMageObj = Mage::getModel('catalog/product');
	$products = $catalogMageObj->loadByAttribute('sku', $sku);

	$custom_attributes = array();
	$attributes = $products->getAttributes();
	foreach ($attributes as $attribute) {
		if ($attribute->getAttributeCode() =="category_ids"){
			$custom_attributes[] = array(
				"attribute_code"=> $attribute->getAttributeCode(),
				"value"=> $products->getCategoryIds()
			);
		}
		else{
			$custom_attributes[] = array(
				"attribute_code"=> $attribute->getAttributeCode(),
				"value"=> $attribute->getFrontend()->getValue($products)
			);
		}
	}
				
	$data = array(
		'id' => $products->getEntityId(),
		'sku' => $products->getSku(),
		'name' => $products->getName(),
		'attribute_set_id' => (int)$products->getAttributeSetId(),
		'price' => $products->getPrice(),
		'status' => $products->getStatus(),
		'visibility' => $products->getVisibility(),
		'type_id' => $products->getTypeId(),
		'created_at' => $products->getCreatedAt(),
		'updated_at' => $products->getUpdatedAt(),
		'product_links' => $productstypes, 
		'custom_attributes'  => $custom_attributes
	);
		
	//return $products;
	return $data;
}

How to get Configured Product Extension Attributes

Getting all options of a specific attribute in Magento is fairly easy but sometimes A more challenging task is to get the options and values that are applicable to a particular configurable product. This can solve using the following code:

// get product extension attributes details
	public function getProductExtensionAttributes($productObj){
		
		if (!is_object($productObj)){
			return false;
		} 
		
		$extensionAttributesFinalArray = array();
		$extensionAttributesArray = array();
		if ($productObj->isConfigurable()){
			$optionsData = $productObj->getTypeInstance(true)->getConfigurableAttributesAsArray($productObj);
			foreach ($optionsData as $option) {
				// get option values
				$values =  $option['values'];
				$tempDataItems = array();
				foreach ($values as $value) {
					$tempData = array(
							"value_index" => $value['value_index'],
							"title" => $value['label']
					);
					$product_super_attribute_id =  $value['product_super_attribute_id'];
					array_push($tempDataItems, $tempData);
				}
				
				// create temp array for extension_attributes
				$extensionAttributesTempArray = array(
						"id" => $option['id'],
						"label" => $option['label'],
						"position" => $option['position'],
						"attribute_id" => $product_super_attribute_id,
						"values" => $tempDataItems,
						"product_id" => (int)$productObj->getEntityId(),
				);
				array_push($extensionAttributesFinalArray, $extensionAttributesTempArray);
			}
			$extensionAttributesArray['configurable_product_options'] = $extensionAttributesFinalArray;
			$extensionAttributesArray['configurable_product_links'] = [];
		}
		
		// returning response
		return $extensionAttributesArray;
	}

The resulting array will consist of an associative array, indexed by the attribute label, with nested arrays containing attribute value => attribute label items.

Conclusion

This is the era of eCommerce with the Mobile app as peoples are spending time on their mobile. The user has various choices to purchase an item from the web that’s why your eCommerce website should remain competitive in your business. The mobile app is a new way, which turns your Magento website into a fully functional eCommerce store with everything user needs.

On this tutorial, we have discussed how to get all the product details Magento which you can use to develop your Magento Mobile App.

References

Further reading

Ultimate Magento 1 Developer Guide : Token Base Rest API for authentication and authorization

Security has always been a major concern we talk about high-level applications or mobile apps, especially when we talk about exposing our business through services. I have already explained a lot of REST API in my earlier articles. I explained, how do we create a Magento 1 REST API, how do we get the available categories from the store, How can you search the products in your mobile app etc. This article will explain how to make token based REST API to handle authentication among the devices. There is no standard way of doing token based authentication on the Magento 1 that’s why we design our own security technique and structure which suits best to our application.

One of the key principles of REST is that it’s stateless. This means that the server never keeps user state. In the context of security, this aspect has impacts when implementing security. This means that authentication hints must be sent and verified at each time.  An authenticated user will be allowed to access resources for a particular period of time and can re-instantiate the request with an increased session time delta to access other resource or the same resource.

Magento REST API Security

Magento 1 Security in itself is very complicated and tricky topic. I’ll try to explain how we can achieve it in REST API security in my own way. When we plan to create a mobile app, we especially want to take care of authentication and authorization. There are various ways to achieve security in Magento 1 but we have decided to use token-based authentication on our mobile app.

Authentication

Authentication is all about the identity of an end user. It’s about validating the identity of a user who is accessing our system, that he is authenticated enough to use our resources or not. Does that end user have valid credentials to log in our system? Credentials can be in the form of a username and password. We’ll use Basic Authentication technique to understand how we can achieve authentication in WebAPI.

Authorization

Authorization should be considered as a second step after authentication to achieve security. Authorization means what all permissions the authenticated user has to access web resources. Is allowed to access/ perform an action on that resource? This could be achieved by setting roles and permissions for an end user who is authenticated or can be achieved through providing a secure token, using which an end user can have access to other services or resources.

Magenot Token Based Authorization

Authorization part comes just after authentication, once authenticated a service can send a token to an end user through which user can access other resources. The token could be any encrypted key, which only server/service understands and when it fetches the token from the request made by the end user, it validates the token and authorizes user into the system. Token generated could be stored in a database or an external file as well i.e. we need to persist the token for future references. The token can have its own lifetime and may expire accordingly. In that case, the user will again have to be authenticated into the system.

Implementation of the token based authorization in Magento 1

Below is the code which we have used to create & manage tokens in Magento 1.x version.

 Public function generateUserToken($data){
        // get the username & password of the user
        $username = $data['username'];
    	$password = $data['password'];

        // check username password exists on our system or not
         if (!$customer->authenticate($username, $password)) {
              // user is not registered with this Magento 1 website
         }

        // load customer details if exist
	$customerObj = $customer->loadByEmail($username);
	$customerId =  $customerObj->getEntityId();

        // check user token is already generated or not and return token if exist and return the token from database if exist
	$customerapitokensObj = Mage::getModel('customerapi/customerapitokens');
	$customerapitokensObj->load($customerId, 'customer_id');
	if ($customerapitokensObj->getToken()){
		$token = $customerapitokensObj->getToken();
		return $token;
	}

        // generate token and save customer tokens
	try {
                // create MD5 token with username and password and date comibanation to make token unique
		$date  = date("Y-m-d H:i:s")."".$username."".$password;
		$token = md5(uniqid($date, true));
				
		$customerapitokensObj->setCustomerId($customerId);
		$customerapitokensObj->setToken($token);
		$customerapitokensObj->setStatus(1);
		$customerapitokensObj->setDate(date("Y-m-d H:i:s"));
		$newUserData = $customerapitokensObj->save();
				
		return $token; 
	} catch (Exception $e) {
		$this->_critical($e->getMessage(), Mage_Api2_Model_Server::HTTP_UNAUTHORIZED);
	}

}

Database Structure for the Token support

magentoTokenBasedAutentication

 

Conclusion

In this article, I tried to explain about how we can build an API application with basic Authentication and Authorization. One can mold this concept to achieve the level of security needed. If you want to implement Token-based-authentication on your Magento 1 mobile apps then you will find these above steps easier. The above code will create and manage the token-based authentication on your Magento 1 store and you can display on your mobile app. If any better approach or solution your thoughts are most welcome. Please share with us so that it might help others as well.

References

Further reading

 

Ultimate Magento 1 Developer Guide : How to get Country and Region Collection using rest API in Magento 1.x ?

Sooner or later you’ll run into a case where you need REST API for your online store and you found that Magento 1 does not support all Magento 1 REST API. What should you do now? How can you write REST API for your online store as per client need?

The Magento 1 REST API allows you to use various data entities such as customer, catalog and order information to third party applications. I’d like to share it with you a quick, simple, well written and easy solution which will explain how can you retrieve the data with the help of REST API.

When working with Magento 1 REST API, for some specific reasons a developer wants to access a list of countries with regions to display the countries list on the mobile app. We first needed to access a collection of countries in Magento 1, then we will get the region based on the country. Below is some sample code that we can use to access country names and codes in Magento.

Magento 1 collection of all countries

Magento 1 has a model which provides all the countries list and below is the code for getting the collection of all countries.

       public function getCountryCollection(){
            //get the all countries
            $countryCollection = Mage::getModel('directory/country_api')->items();
       }

Magento 1 collection of regions related to specific country

Magento 1 has a predefined model which takes countryId and return all the available region, below is the code for getting the available region based on the countryId.

      public function getRegionByCountryId(){
              // get region based on countries
              $regions = Mage::getModel('directory/region_api')->items($countryId);
      }

Get All countries Collection with their Region

Magento 1 has a predefined way to get countries and available region of the specified countries but does not provide the all countries list with the available region. I have used both above ways to create a single REST API and get all the countries along with the regions. Below is the complete code.

        
public function getCountriesWithRegions(){
         //get all countries
        $countryCollection = Mage::getModel('directory/country_api')->items();
	$countries = array();
	foreach($countryCollection as $country)
	{	
		// get region based on countries
		$regions = Mage::getModel('directory/region_api')->items($country['country_id']);
		$availableRegion = array();
		foreach ($regions as $region){
			$temData = array(
				'id' => $region['region_id'],
				'code' => $region['code'],
				'name' => $region['name']
			);
			array_push($availableRegion, $temData);
		}
			
		// creating array which contains country with available region
		$data = array(
			'id' => $country['country_id'],
			'two_letter_abbreviation' => $country['iso2_code'],
			'three_letter_abbreviation' => $country['iso3_code'],
			'full_name_english' => $country['name'],
			'available_regions' => $availableRegion
		);
			array_push($countries, $data);
	}
		
	// returning response
	return $countries;
}

Conclusion

This is the era of eCommerce with the Mobile app as peoples are spending time on their mobile. The user has various choices to purchase an item from the web that’s why your eCommerce website should remain competitive in your business. The mobile app is a new way, which turns your Magento 1 website into a fully functional eCommerce store with everything user needs.

On this tutorial, we have discussed how to get all the country list along with the region in Magento 1 which you can use to develop your Magento 1 Mobile App.

References

Further reading

Ultimate Guide to send OTP using PHP(Twilio) in 5 minutes?

Are you facing an increase in attempts by spam to gain unauthorized access to your website? Once you’ve launched your website and you haven’t put any spam prevention measure in place. Verification Code allows you to protect your website by adding send SMS verification functionality to User Registration functions before the user can see the full content of your website.

Verification Code is used Twilio Networks HTTP API to send messages, meaning you will need a valid Twilio Networks username and password in order to be able to send SMS messages. The account can be obtained from the https://www.twilio.com

 

Basic Php Integration to Send SMS with Twilio

1. How to Setup Twilio

To send SMS and outgoing messages perform an HTTP POST to the Messages resource URI. We will also use the Twilio PHP Library for making REST requests.

If you are using a Twilio Trial account for this example, you will only be able to send SMS messages to phone numbers that you have verified with Twilio. Phone numbers can be verified via your Twilio Console’s Verified Caller IDs. The ‘From’ parameter will also need to be a phone number you purchased from Twilio.

Create an account on Twilio.

  • Follow this link for creating account on Twilio https://www.twilio.com.
  • If you created the trial account on Twilio then you can send SMS to only the verified number of Twilio account.
  • For send SMS on any number you need to create a premium account or upgrade the Twilio account.

2. Scheduled SMS campaigns

You’ll be assigned a number when you sign up to Twilio that you can use for testing but can’t send any actual texts through it. We just credited the account straight away so we could see the text coming through life. For us and probably most others we only needed to send a handful of texts whilst testing. As you’ll see further down this write-up the library provided by Twilio is super simple and you are only charged when a text is successfully delivered so for the cost of having the convenience of actual messages being delivered to real phones was well worth it.

Sign up for a free Twilio account and buy a phone number.

3. Grab the PHP library and your API credentials

Download the PHP library provided by Twilio and put it somewhere that it can be included in the PHP script you want to use to send the SMS text. When sending your messages you’ll also need your account sid and your Auth Token. These can be grabbed from your account settings.

4. Set up the sending of the message

Firstly include the PHP library you’ve just downloaded and unzipped:

require "PATH YOUR TWILIO LIBRARY/Services/Twilio.php";
$client = new Services_Twilio('ACCOUNT SID HERE', 'AUTHTOKENHERE');

You have to find your account SID and auth token in your console dashboard, and your phone number in your phone numbers list. Create a file called settings.php to store these values.

 
     $account_sid = "YOURACCOUNTSID";
     $auth_token = "YOURAUTHTOKEN";
     $twilio_phone_number = "+YOURTWILIONUMBER";

Create a file called send-SMS.php and paste the code below to:

  • Include the helper library and settings file
  • Create a Twilio client using your account credentials
  • Create a new message from our Twilio number to your cellphone
require "PATH YOUR TWILIO LIBRARY/Services/Twilio.php";
include 'settings.php';
$client = new Services_Twilio('ACCOUNT SID HERE', 'AUTHTOKENHERE'); 
$client->account->messages->create(array(
  'To' => 'NUMBER OF RECIPIENT',
  'From' => 'NUMBER PURCHASED WITH YOUR ACCOUNT',
  'Body' => "THIS IS YOUR TEXT MESSAGE",
));

Save your file and run it:
php send-SMS.php

Conclusion

It’s as easy as that! You’ll now be sending live text messages via PHP and Twilio. You can keep an eye on the outgoing messages via the logs area of your Twilio account area and keep an eye on costs via the usage area.
Following on from that we set the header type text/plain and simply output what we’d like to be text back to the number that has sent the text, Twilio does the rest. That’s sending text messages and handling a response via a text all wrapped with a small amount of code.

References

Twilio Docs
The Twilio Php Helper Library
SEND SMS AND MMS MESSAGES IN PHP

Further Reading

Twilio voice: Receive Call On Your Android Mobile
Easy way to play an audio file on call in android using Twilio
How to enable two-step verification in Socialengine websites

Ultimate guide to edit and delete address in magento mobile app

Magento is based on open source platform for e-commerce which provides smooth shopping cart system with control over the look and functionality of the store. It is growing in the e-commerce market day by day. More traders are using this platform for their e-store. It provides a various feature for an e-commerce store, you can check its features in our previous blog. With the increase in the e-commerce stores, mobile-commerce has also become popular these days. Mobile visits account for one-third of e-commerce sites traffic. To have an e-commerce mobile app for electronic commerce store is like putting a  retail outlet in the customer’s pocket. Magento provides SEO, items management, and other tools. It enforce traders to have the mobile app for superb shopping experience for customers.  In this blog, I am going to discuss some important features i.e edit delete address Magento in the mobile app using REST API.

Edit Delete address Magento:

Here we will discuss the edit delete address Magento in a mobile app using REST API. Here we take an example of two address.

{
 "customer": 
   {
     "email": "[email protected]",
     "firstname": "test",
     "lastname": "test",
     "websiteId": 0,
        "addresses": [
           {
              "id": 1,
              "firstname": "test",
              "lastname": "test",
              "company": "test technology",
              "street": ["Test Street 9", "Tiny House 9"],
              "city": "City Nine",
              "region_id": 12,
              "region": "California",
              "postcode": "91790",
              "country_id": "US",
              "telephone": "1234567890"
           }, 
           {
             "id": 2,
             "firstname": "test",
             "lastname": "test",
             "company": "test technology",
             "street": ["Test Street 10", "Tiny House 10"],
             "city": "City Ten",
             "region_id": 12,
             "region": "California",
             "postcode": "91790",
             "country_id": "US",
             "telephone": "1234567890"
            }]
   }
}

Edit address in Magento:

Below is the API to create a customer. Then put the parameters for the address:

 PUT http://Base URL/rest/V1/customers/me

Now we can edit the address by using the address id. If we send the address id with change data then only that address will be changed that we want to edit. If we don’t send the address id then the new address will be generated.


{ "customer":
    {
       "email":"[email protected]",
       "firstname":"test",
       "lastname":"test",
       "websiteId": 0,
       "addresses": [
            {
                "id": 1,
                "firstname": "testedit",
                "lastname": "testedit",
                "company": "test technology edit",
                "street": [
                "Test Street 9",
                "Tiny House 9"
                ],
                "city": "City Nine edit",
                "region_id": 12,
                "region": "California",
                "postcode": "91790000",
                "country_id": "US",
                "telephone": "123456789000"
            },
            {
                "firstname": "test",
                "lastname": "test",
                "company": "test technology",
                "street": [
                "Test Street 10",
                "Tiny House 10"
                ],
                "city": "City Ten",
                "region_id": 12,
                "region": "California",
                "postcode": "91790",
                "country_id": "US",
                "telephone": "1234567890"
            }
        ]
    }

In the example we send the address id with the parameters then id with 1 will be edited.

Delete address in Magento:

Below is the API to create a customer. Then put the parameters for the address:

PUT http://Base URL/rest/V1/customers/me

Now we can delete the address by not sending the address in the parameter. For example, we want to delete the address with id 1. Then we will not send the id 1 in the addresses. Then that address will not be generated and that address will not come in the address list.

 { "customer":
    {
       "email":"[email protected]",
       "firstname":"test",
       "lastname":"test",
       "websiteId": 0,
       "addresses": [
            {
                "id":2
                "firstname": "test",
                "lastname": "test",
                "company": "test technology",
                "street": [
                "Test Street 10",
                "Tiny House 10"
                ],
                "city": "City Ten",
                "region_id": 12,
                "region": "California",
                "postcode": "91790",
                "country_id": "US",
                "telephone": "1234567890"
            }
        ]
    }

By this address id with 1 will be deleted.

These are the ways to edit and delete the address in the Magento app using the Mgento API.

Conclusion

As the implementation of Magento framework is increasing day by day for the e-commerce stores, demand for mobile commerce is also increasing with the same speed and popularity. So developing an e-commerce mobile app is becoming common and for any e-commerce store edit and delete address are very common and powerful property. Keeping these all things in mind I wrote this article to help the new developer for Magento. I hope this will help you… :-). Below is our sample app based on Magento REST API, you can refer it as an example which has shown the use of edit deletes address Magento using REST APIs.

magento-logo
MagentoShop
Looking for a native Magento mobile app builder (iOS/Android) for your Magento based online marketplace? Try the 30-day free trial of our Magento mobile app, go mobile commerce in a few hours and increase your sales exponentially. No Setup Fee, Pay as you go pack at just $69/month.

References

  • Magento: Magento Documentation for Developers
  • Magento API: Magento API Documentation for Developers. Get the Edit Delete address Magento API.

Further reading:

The Death Of Magento Performance: 13 Common Guidelines

The world is moving fast, and people’s attention span is decreasing. Even for online shopping people opt for it because they can save a lot of time and efforts in the process. So, speed and good Magento performance are central to the success of any eCommerce store. A 1-second delay in page response can result in a 7% reduction in conversions. The speed of your business website matters. Fast-loading websites perform better on every front: higher search ranking, excellent user experience, and better user engagement. Most importantly, quick-loading websites deliver higher conversions and higher revenue.

When we are talking about the Magento Performance site, it’s not just about the page load speed, but every function and process a customer has to go through from searching for products to the checkout process. Performance optimization is an integral part of Magento development and cannot be underestimated. Magento 2 has fixed many issues with the previous version, but there is still a lot you can do to improve the performance of your Magento 2 site.

Magento Performance: 13 Common Guidelines

There are many Magento Performance optimization techniques out here. In this post, I am going to share with you some simple tips to speed Magento 2 store.

Server Requirement & configuration optimization

As you may know, the server is the key factor for Magento Performance. If your picked server is not good enough you can’t have a good website. Hence, to have a good website, we suggest you replace it with a dedicated server. Moreover, when you choose a host, please keep these categories in mind.

Code and Database Optimization

Regularly Improve your database performance using query indexing and broad optimization scripts. Use your DB management system to optimize the database on the frequent basis. Let’s me show you little tips to optimize via MySQL configuration. You can try and get the following settings in my.cnf

  
query_cache_type = 1
query_cache_size = 32M
query_cache_limit=2M
php_value memory_limit 128M

Optimize Magento database by Cleaning log

If you are wondering when you need to optimize Magento database, you can check your site. In case you have around 200MB, it is time for cleaning.

Enable JS & CSS optimization

CSS and JS file help your front end look better. Yet, they are one of the core factors that slow down your site speed. Luckily you can cut influence in magento 2 by enabling JS & CSS optimization.

To enable JS & CSS optimization: Go to Stores -> “Configuration” in “Settings” Section -> “Developer” in “Advanced” Tab -> Section “JavaScript Settings” (Fields “Enable Javascript Bundling“, “Merge JavaScript Files“, “Minify JavaScript Files” change to “Yes”)

css optimization

Go to Stores -> “Configuration” in “Settings” Section -> “Developer” in “Advanced” Tab ->-> Section “CSS Settings” (Fields “Merge CSS Files“, “Minify CSS Files” change to “Yes“)

css optimization

Use CDN

Implementing a Content Delivery Network (CDN) with Magento is one of the easiest ways to instantly see decreased load times which enables serving your assets from a location geographically closest to your customers and hence reduces latency and increases download speed for those assets. To set up CDN, please go to STORES -> Configuration -> GENERAL -> Web -> Base URLs (Secure) then insert your HTTPS URLs in here and bring your customers fast loading speed.

Images Optimization

You shouldn’t use images that are much larger than necessary. If your site requires a small image, such as 50 x 50, there is no need to upload a much larger file to get the same result.

Enable Cache for Magento Performance

Caching improves load speed response time on your Magento Store. A cached page will be stored after one visit or pre-generated and stored. Magento Enterprise Edition offers full page caching as a default option for the category, product, and CMS pages. To Enable cache Go to Stores -> “Configuration” in “Settings” Section -> “Catalog” in “General” Tab -> Section “Storefront” -> Fields “Use Flat Catalog Category” and “Use Flat Catalog Product” change to “Yes”.

css optimization

Minify CSS, JavaScript, and HTML

Minifying removes all unnecessary characters from source code without changing its functionality. These unnecessary characters usually include white space characters, new line characters, and comments, which are used to add readability to the code but are not required for it to execute.

Enable Flat Categories and Products

One of the main problems that slow down Magento Performance 2 speed is the read speed of database; especially, in case your Magento 2 store has a large number of products. To enable flat-options: Go to Stores -> “Configuration” in “Settings” Section -> “Catalog” in “General” Tab -> Section “Storefront” -> Fields “Use Flat Catalog Category” and “Use Flat Catalog Product” change to “Yes”.

css optimization

 

Catalog Size

The larger your catalog, the greater the burden on your server(s) to load pages, especially when we’re talking about SKUs tipping over 100K. You can enable Flat Categories and Products to improve load speed.

Check Links

A broken link is a hyperlink to a webpage that doesn’t exist it’s a waste of your page’s load time.

Change to Production Mode

It is recommended to always upgrade your Magento system, your plugins, and other software your website depends on (to the latest version).

Change to Production Mode

Intended for deployment on a production system. Exceptions are not displayed to the user, exceptions are written to logs only, and static view files are served from `pub/static` only. New or updated files are not written to the file system.

php bin/magento deploy:mode:set production

Conclusion

In today’s world increasing page speed performance is getting more and more important for websites, especially for eCommerce stores, because users are becoming more demanding in terms of user experience. I have described how to speed up load times in Magento with recommending a number of solutions. If you are planning to increase Magento Performance and page speed on your website or mobile app then this article gives you the complete guide in less time and effort. You can also join the conversation if you have any other solution or idea which we can use to make it more attractive and easy. That’s all folks and feel free to contact us in case if you have any query.

References

Further reading

14 features in eCommerce Mobile App to increase your sales

The boom in mobile eCommerce has led to the creation of mobile apps and platforms. Our generation has become a comfortable shopping and paying their mobile devices. Smartphones and eCommerce Mobile App are having a meaningful impact on how we buy. Sales via the eCommerce Mobile App have grown 39% over last year to reach $123.13 billion this year in the United States. This means m-commerce will account for 1/3 of all eCommerce sales. Here is a list of 14 must-have features that attract online shoppers.

eCommerce Mobile App Features

  1. Simple Registration Process: Almost customers will not like to fill the long forms demanding too much information. Make the registration process simple & put smallest required fields for ease operation. People rarely prefer the app which demands too much information for a registration.
  2. All payment options supported: Sometimes it happens that a buyer has a strong wish to buy a product from the specific mobile app. Unfortunately, he doesn’t find the payment option he wants, then it may result in the decreased sale ratio. Put all possible payment options which are used by the most shoppers.
  3. Eye-popping themes: A phone has a limited space and if the design is too cluttered, it would make the user journey complicated. Ensure the app uses space without compromising on design and meets business objectives. Moreover, the visual should be attractive, engaging and must convey to the users. What an app does and why it is better than the competition
  4. A feature of Push Notifications: Some of the most successful eCommerce mobile apps are the ones that have Push Notifications into their list of features. Push notifications tend to inspire immediate action like exclusive promotions, special offers. You can pair up this feature with analytics, and you would see a significant boost in sales in no time.
  5. 100% Custom Branding: Get a custom mobile app with your own logo and color combinations at a nominal cost of development. which will add greatest features to your users like displaying products listing, users account creation, adding into carts, apply coupons, checkout, view order and much more.
  6. Synchronizations: Any changes on the website to the Categories, Catalog or Customers profile get reflected in your mobile phone app. So you don’t have to perform the changes on your app again
  7. Google Analytics: Google Analytics for Mobile Apps measures your app’s full value. See what users love and how to make them happier — and make your app more successful.
  8. Product Review: You might think that having negative reviews is a sale killer. The opposite is actually true. Having negative reviews can often be positive. It’s shown that products without negative reviews are seen as censored.
  9. Wish List Button: E-commerce sites that aren’t using wish lists are leaving revenue on the virtual desktop table. What’s better than having customers bookmark items they want and will most likely buy in the future?
  10. Related Products: People that buy online are impatient and you constantly lose sales as a result. Use Recomatic to display smart Related Products and get those sales back. No time to set it up? No problem! We take care of everything for you.
  11. Quick Checkout: A mobile app should contain Quick Checkout feature. The Quick Checkout feature allows shoppers to complete an order with predefined information from the quick check out profile and automatically sets the shipping and billing addresses for the customer.
  12. Multi-Currency: Build Magento app that can transact in an endless list of international currencies including USD, GBP, EURO, AED, YEN, INR and much more. Offer customers the true experience of international payments, anywhere, anytime.
  13. Multi-Lingual: A mobile app should also contain multiple language support so that customer can convert your store into 30 or more languages of their choice by simply selecting the languages from the drop down menu.
  14. Return Policy: Return policies are an essential feature of any e-commerce website. return policy should be clearly visible and well-written or illustrated.

Above mentioned are just main features that any E-commerce app must have. Excluding these, there are many other features which make the app successful. So, for the extended requirements of your business, you may have other customized app features.

Conclusion

A Good mobile app involves more than technology and the latest tools. An effective mobile app is a platform that requires a solid strategy. These are the very common feature which a mobile app have. If you are planning to create an eCommerce mobile app than the experienced team at Ipragmatech will help you. We will first understand your ideas and then creates an amazing product to you. which is Mobile App Builder for e-commerce Mobile App to you. If you need more help and idea about setting up your mobile app, feel free to contact us.

References

Magento: A Gift for You

Mobile app builder for your online store based magento2

Further Reading

7 Reasons to choose Magento eCommerce platform for your Online Store

A complete guide to build a native e-commerce mobile app

6 Reasons eCommerce Store Needs Mobile App

 

Magento salesforce integration with Customers in 3 Creative Steps

If you are running eCommerce website then you always fear to lose your customer accounts one solution is to keep the backup on daily basis but it comes very headache to keep lots of backups also need lots of space. Another solution is Magento 2 customers Salesforce integration.There are two ways for Magento Salesforce Integration for customers. One is to do is manually or another is to do it automatically (Using crone on specific events). We have described the automatically approach to synchronize Magento Salesforce Integration for customers.

Magento Salesforce Integration for Customers

Following are the steps to Magento Salesforce Integration for customers  based upon Magneto 2 customers creation or update

Step 1: Entering Observer event in the XML

This is the important part to handle the event into Magento 2. Go to your module ->etc->frontend and verify that the XML file named as the event.xml exists or not if exist then create. Open event.xml and do the following code inside this

 

    ............
    ............
    <event name="customer_save_after">
        <observer name="customer_save_after" instance="Package\Module Name\Observer\CustomerUpdateObserver" />
    </event>
    ............
    ............

Step 2: Creating Observer

Now we have to create the observer file to perform Magento Salesforce Integration operations according to our need. In my case my observer name is CustomerUpdateObserver.php . To create the file go to path project/app/code/package/module/Observer/ and create you observer here with following code.

add your needed helper files inside the constructor

 ........
 ......
 public function __construct(
        \Magento\Framework\ObjectManagerInterface $objectManager, //to performs some operations 
        \Ipragmatech\Msintegration\Helper\Account\Data $helper //we have written our functions inside this helper
    ) {
        $this->_objectManager = $objectManager;
        $this->_helper = $helper;
    }

Add the following line of code inside the execute function of observer

       try {
            $customer = $observer->getEvent()->getCustomer();
            $salesforceId = $this->_helper->getClientSfId($customer->getId());
            if (empty($salesforceId)) {
                $id = $this->_helper->createAccount($customer);
                if (!empty($observer->getCustomerAddress())) {
                   $this->_helper->updateAddress($observer->getCustomerAddress(), $id);
                }
            } else {
                $this->_helper->updateAccount($salesforceId, $customer);
                if (!empty($observer->getCustomerAddress())) {
                    $this->_helper->updateAddress($observer->getCustomerAddress(), $id);

                }
            }
        } catch (\Exception $e) {
            // do what ever you wanna perform based on your exception log or some operation
        }


 

Step 3: Create Helper file

Go to helper folder create a folder named Account and inside folder create a file named Data.php. Inside the file, we need to write our functions for creating a customer account, updating customer, and updating customer address.

  • Creating customer account on the Salesforce
     public function createAccount($customer)
        {
            $name = $customer->getFirstname() . " " . $customer->getLastname();
            $email = $customer->getEmail();
            $lastUrl = "sobjects/Account/";
    
            $params = array(
                array(
                    "Name" => $name,
                )
    
            );
            $acountResult = $this->_helper->postAction($params, $lastUrl);
            $response = $acountResult ['response'];
            $status = $acountResult ['status'];
            $id = $response["id"];
            $mappingArray = [
                'customer_id' => $customer->getId(),
                'customer_salesforce_id' => $id,
    
            ];
            try {
                $model = $this->_objectManager->create('Ipragmatech\Msintegration\Model\Customermapping');
                $model->setData($mappingArray);
                $model->save();
            } catch (\Exception $e) {
                // put your own code
            }
    
            return $id;
        }
  • Updating customer account on Salesforce
     public function updateAccount($salesforceId, $customer)
        {
    
            $name = $customer->getFirstname() . " " . $customer->getLastname();
            $email = $customer->getEmail();
            $lastUrl = "sobjects/Account/$salesforceId";
            $params = array("Name" => $name);
            $updateAccount = $this->_helper->updateAction($params, $lastUrl);
            $status = $updateAccount ['status'];
    
            if ($status != 204) {
               // failed with status 
            }
            return true;
    
        }
  • Updating customer address on the Salesforce
        public function updateAddress($addressObject, $salesforceId)
        {
            $name = $addressObject->getFirstname() . " " . $addressObject->getLastname();
            $streets = $addressObject->getStreet();
            $country = $addressObject->getCountry();
            $city = $addressObject->getCity();
            $postCode = $addressObject->getPostCode();
            $company = $addressObject->getCompany();
            $state = $addressObject->getState();
            $telephone = $addressObject->getTelePhone();
            $strt = "";
            foreach ($streets as $street) {
                $strt .= "," . $street;
            }
    
            $lastUrl = "sobjects/Account/$salesforceId";
    
            $params = array(
                array(
                    "Name" => $name,
                    "BillingCity" => $city,
                    "BillingStreet" => $strt,
                    "BillingState" => $state,
                    "BillingPostalCode" => $postCode,
                    "BillingCountry" => $country,
                    "ShippingCity" => $city,
                    "ShippingStreet" => $strt,
                    "ShippingState" => $state,
                    "ShippingPostalCode" => $postCode,
                    "ShippingCountry" => $country,
                    "Phone" => $telephone
                )
            );
            try {
                $updateAddress = $this->_helper->updateAction($params, $lastUrl);
                $status = $updateAddress ['status'];
                if ($status != 204) {
                    //your own message call has been failed
                return true;
            } catch (\Exception $e) {
               //handle exception accordingly
            }
    
        }
    

Conclusion

The Magento Salesforce Integration for sync customers is an advantageous integration tool for Magento 2 and Salesforce. In this Magento Salesforce Integration you do not encounter any technical difficulties or confusion with it, support for this Magento Salesforce Integration is available, you can ask the question on this blog or you may have a look at a solution which we have already implemented for Magento Salesforce Integration, products and orders to Salesforce on their update/ create in Magento 2. Click here to know about our plugin. So don’t wait any longer, go for it!

References

Further Reading

Ultimate Guide to send OTP using PHP(Twilio) in 5 minutes?

Are you facing an increase in attempts by spam to gain unauthorized access to your website? Once you’ve launched your website and you haven’t put any spam prevention measure in place. Verification Code allows you to protect your website by adding send sms verification functionality to User Registration functions before the user can see the full content of your website.

Verification Code is used Twilio Networks HTTP API to send messages, meaning you will need a valid Twilio Networks username and password in order to be able to send SMS messages. The account can be obtained from the https://www.twilio.com

Basic Php Integration to Send SMS with Twilio

1. How to Setup Twilio

To send SMS and outgoing messages perform an HTTP POST to the Messages resource URI. We will also use the Twilio PHP Library for making REST requests.

If you are using a Twilio Trial account for this example, you will only be able to send SMS messages to phone numbers that you have verified with Twilio. Phone numbers can be verified via your Twilio Console’s Verified Caller IDs. The ‘From’ parameter will also need to be a phone number you purchased from Twilio.

Create an account on Twilio.

  • Follow this link for create account on Twilio https://www.twilio.com.
  • If you created trial account on Twilio then you can send SMS to only the verified number of Twilio account.
  • For send SMS on any number you need to create premium account or upgrade the Twilio account.

2. Scheduled SMS campaigns

You’ll be assigned a number when you sign up to Twilio that you can use for testing but can’t send any actual texts through it. We just credited the account straight away so we could see the text coming through live. For us and probably most others we only needed to send a handful of texts whilst testing. As you’ll see further down this write up the library provided by Twilio is super simple and you are only charged when a text is successfully delivered so for the cost of having the convenience of actual messages being delivered to real phones was well worth it.

Sign up for a free Twilio account and buy a phone number.

3. Grab the PHP library and your API credentials

Download the PHP library provided by Twilio and put it somewhere that it can be included in the PHP script you want to use to send the SMS text. When sending your messages you’ll also need your account sid and your Auth Token. These can be grabbed from your account settings.

4. Set up the sending of the message

Firstly include the PHP library you’ve just downloaded and unzipped:

require "PATH YOUR TWILIO LIBRARY/Services/Twilio.php";
$client = new Services_Twilio('ACCOUNT SID HERE', 'AUTHTOKENHERE');

You have to find the your account SID and auth token in your console dashboard, and your phone number in your phone numbers list. Create a file called settings.php to store these values.

 
     $account_sid = "YOURACCOUNTSID";
     $auth_token = "YOURAUTHTOKEN";
     $twilio_phone_number = "+YOURTWILIONUMBER";

Create a file called send-sms.php and paste in the code below to:

  • Include the helper library and settings file
  • Create a Twilio client using our account credentials
  • Create a new message from our twilio number, to our cellphone
require "PATH YOUR TWILIO LIBRARY/Services/Twilio.php";
include 'settings.php';
$client = new Services_Twilio('ACCOUNT SID HERE', 'AUTHTOKENHERE'); 
$client->account->messages->create(array(
  'To' => 'NUMBER OF RECIPIENT',
  'From' => 'NUMBER PURCHASED WITH YOUR ACCOUNT',
  'Body' => "THIS IS YOUR TEXT MESSAGE",
));

Save your file and run it:
php send-sms.php

Conculsion

It’s as easy as that! You’ll now be sending live text messages via PHP and Twilio. You can keep an eye on the outgoing messages via the logs area of your Twilio account area and keep an eye on costs via the usage area.
Following on from that we set the header type text/plain and simply output what we’d like to be text back to the number that has sent the text, Twilio does the rest. That’s sending a text messages and handling a response via a text all wrapped with small amount of code.

References

Twilio Docs
The Twilio Php Helper Library
SEND SMS AND MMS MESSAGES IN PHP

Further Reading

Twilio voice: Receive Call On Your Android Mobile
Easy way to play an audio file on call in android using twilio
How to enable two step verification in Socialengine websites