{"id":6752,"date":"2021-04-21T13:51:54","date_gmt":"2021-04-21T08:21:54","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=6752"},"modified":"2023-01-20T18:55:05","modified_gmt":"2023-01-20T13:25:05","slug":"android-architecture","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/android-architecture\/","title":{"rendered":"Android Architecture"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Android architecture is defined as the, A Guide to android app architecture with libraries for a different task, it helps us to create an app that is robust, testable, maintainable, and has less boilerplate code,<\/span><\/p>\n<p><strong>Architecture component is part of Android jetpack<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">Android jetpack is collection of android software component like data binding, lifecycles, livedata, app component, etc, it makes android development easy because it gives proper architecture to develop an application which has minimal boilerplate code<\/span><\/p>\n<h2><strong>Android Architecture components<\/strong><\/h2>\n<ul>\n<li><span style=\"font-weight: 400;\">DataBinding<\/span><\/li>\n<li><span style=\"font-weight: 400;\">LifeCycleAwareComponent<\/span><\/li>\n<li><span style=\"font-weight: 400;\">LiveData<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Navigation<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Paging\u00a0<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Room<\/span><\/li>\n<li><span style=\"font-weight: 400;\">ViewModel<\/span><\/li>\n<li><span style=\"font-weight: 400;\">WorkManager<\/span><\/li>\n<\/ul>\n<h3><strong>LifeCycleAwareComponent :&#8212;-<\/strong><\/h3>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-6772 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-69.png\" alt=\"\" width=\"766\" height=\"327\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-69.png 766w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-69-300x128.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-69-624x266.png 624w\" sizes=\"(max-width: 766px) 100vw, 766px\" \/><\/p>\n<p><strong>Q-What are LifeCycleAware components?<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">-Activity\/Fragment\u00a0 is lifecycleowner<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Activity &#8212;&#8211; lifecycle\u00a0 &#8212;&#8211; LifeCycleOwner<\/span><\/p>\n<p><span style=\"font-weight: 400;\">LifeCycle class uses event and state to determine the lifecycle of the lifecycle owner, Each event in the lifecycle is related to the particular state<\/span><\/p>\n<p><strong>LifeCycleObserver:&#8212;&#8212;-<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">Which observe the activity and keep track of its lifecycle thus lifecycle observer performs Action and action depend on lifecycleowner lifecycle event<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">Dependency you have to include in your project&#8212;<\/span><\/i><i><\/i><\/p>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><strong>implementation &#8220;android.arch.lifecycle:extensions:$lifecycle_version&#8221;<\/strong><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><strong>annotationProcessor &#8220;android.arch.lifecycle:compiler:$lifecycle_version&#8221;<\/strong><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\"><br \/>\n<strong>-&gt; LifeCycle class hold info about lifecycle of LifeCycleOwner<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">LifeCycle object uses following enumeration to track LifeCycle status<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">\u00a0Event\u00a0<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\u00a0State<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Lifecycle Owner Provides Lifecycle status to LifecycleAware component<\/span><\/p>\n<p><span style=\"font-weight: 400;\">LifeCycleObserver registers Lifecycle status to respond and perform and perform the action\u00a0<\/span><\/p>\n<p><strong>\/\/ LifecycleOwner<\/strong><\/p>\n<pre class=\"lang:default decode:true \">public class MainActivity extends AppCompatActivity {\r\n\r\nprivate String TAG = this.getClass().getSimpleName();\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Override\r\n\r\nprotected void onCreate(Bundle savedInstanceState) {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.onCreate(savedInstanceState);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0setContentView(R.layout.activity_main);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0getLifecycle().addObserver(new MainActivityObserver());\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Override\r\n\r\n\u00a0\u00a0\u00a0\u00a0protected void onStart() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.onStart();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"owner onstart\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Override\r\n\r\n\u00a0\u00a0\u00a0\u00a0protected void onResume() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.onResume();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"owner onResume\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Override\r\n\r\n\u00a0\u00a0\u00a0\u00a0protected void onPause() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.onPause();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"owner onPause\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Override\r\n\r\n\u00a0\u00a0\u00a0\u00a0protected void onStop() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.onStop();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"owner onStop\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Override\r\n\r\n\u00a0\u00a0\u00a0\u00a0protected void onDestroy() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.onDestroy();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"Observer Removed\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0getLifecycle().removeObserver(new MainActivityObserver());\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n}\r\n\r\npublic class MainActivityObserver implements LifecycleObserver {\r\n\r\n\u00a0\u00a0\u00a0\u00a0private String TAG = this.getClass().getSimpleName();\r\n\r\n\u00a0\u00a0\u00a0\u00a0@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)\r\n\r\n\u00a0\u00a0\u00a0\u00a0public void onCreateEvent() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"ON_CREATE Event\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@OnLifecycleEvent(Lifecycle.Event.ON_START)\r\n\r\n\u00a0\u00a0\u00a0\u00a0public void onStartEvent() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"ON_START event\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)\r\n\r\n\u00a0\u00a0\u00a0\u00a0public void onResumeEvent() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"ON_RESUME event\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)\r\n\r\n\u00a0\u00a0\u00a0\u00a0public void onPauseEvent() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"ON_PAUSE event\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@OnLifecycleEvent(Lifecycle.Event.ON_STOP)\r\n\r\n\u00a0\u00a0\u00a0\u00a0public void onStopEvent() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"ON_STOP event\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)\r\n\r\n\u00a0\u00a0\u00a0\u00a0public void onDestroyEvent() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"ON_DESTROY event\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n}<\/pre>\n<p><strong>Note:&#8211;Lifecycle observer observe the lifecycle event of lifecycle owner(Activity\/Fragment)<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">During the creation of activity\u00a0 owner lifecycle event execute first, during destruction action the lifecycle observer execute first\u00a0<\/span><\/p>\n<p><span style=\"color: #000080;\"><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-ViewModel and LiveData&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/strong><\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-6774 size-large\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-70-1024x427.png\" alt=\"\" width=\"625\" height=\"261\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-70-1024x427.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-70-300x125.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-70-768x321.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-70-624x260.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-70.png 1320w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><strong>The dependency you have to implement in your project<\/strong><\/p>\n<pre class=\"lang:default decode:true\">\/\/ViewModel\r\n\r\n\u00a0\u00a0\u00a0\u00a0implementation \"androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version\"\r\n\r\n\u00a0\u00a0\u00a0\u00a0\/\/ LiveData\r\n\r\n\u00a0\u00a0\u00a0\u00a0implementation \"androidx.lifecycle:lifecycle-livedata:$lifecycle_version\"\r\n\r\n\u00a0\u00a0\u00a0\u00a0\/\/ Saved state module for ViewModel\r\n\r\nimplementation \"androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version\"\r\n\r\n---&gt;View model is not same as onSaveInstanceState()\r\n\r\n---&gt;View model uses for large data such as bitmap or user list\r\n\r\n---&gt;View model store and manage UI related data\r\n\r\n---&gt; View model Destroy only if the owner activity is completely destroyed, in onCleared()\r\n\r\n---&gt;View model Communication layer between Database and UI<\/pre>\n<p><strong><br \/>\nQ &#8211; why do we need a view model?<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">when you start developing an application the most common thing you need to handle is configuration changes<\/span><\/p>\n<p><span style=\"font-weight: 400;\">like:- when we rotate the device the activity is reloaded thus the old data is loss and new one is created, we need to keep our data safe to do that we use viewmodel,\u00a0 then the view model provides the data after changes of configuration<\/span><\/p>\n<p><strong>-&gt; Action perform during changes of configuration<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">during the change of configuration (Activity\/Fragment destroy) the data goes from activity to model and after recreating of activity\/fragment the view model provides the data to UI, Science the activity is created we linked it to view model, using view model provider<\/span><\/p>\n<pre class=\"lang:default decode:true \">public class MainActivity extends AppCompatActivity {\r\n\r\n\u00a0\u00a0\u00a0\u00a0private String TAG = this.getClass().getSimpleName();\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Override\r\n\r\n\u00a0\u00a0\u00a0\u00a0protected void onCreate(Bundle savedInstanceState) {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.onCreate(savedInstanceState);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0setContentView(R.layout.activity_main);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Toolbar toolbar = findViewById(R.id.toolbar);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0setSupportActionBar(toolbar);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0FloatingActionButton fab = findViewById(R.id.fab);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0fab.setOnClickListener(new View.OnClickListener() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0@Override\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public void onClick(View view) {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Snackbar.make(view, \"Replace with your own action\", Snackbar.LENGTH_LONG)\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.setAction(\"Action\", null).show();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0});\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0TextView mTextView = findViewById(R.id.tvNumber);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MainActivityViewModel model = ViewModelProviders.of(this).get(MainActivityViewModel.class);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0String myRandomNumber = model.getNumber();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0mTextView.setText(myRandomNumber);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"Random Number Set\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>ViewModel Class\u00a0 &#8212;&#8212;&#8211;<\/strong><\/p>\n<pre class=\"lang:default decode:true \">public class MainActivityViewModel extends ViewModel {\r\n\r\n\u00a0\u00a0\u00a0\u00a0private String TAG = this.getClass().getSimpleName();\r\n\r\n\u00a0\u00a0\u00a0\u00a0private String myRandomNumber;\r\n\r\n\u00a0\u00a0\u00a0\u00a0public String getNumber() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"Get number\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (myRandomNumber == null) {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0createNumber();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return myRandomNumber;\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0private void createNumber() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"Create new number\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Random random = new Random();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0myRandomNumber = \"Number: \" + (random.nextInt(10 - 1) + 1);\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Override\r\n\r\n\u00a0\u00a0\u00a0\u00a0protected void onCleared() {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0super.onCleared();\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Log.i(TAG, \"ViewModel Destroyed\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n}-<\/pre>\n<p><span style=\"font-weight: 400;\"><br \/>\n<strong>Live data:&#8212;-<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">traditional approach<\/span><span style=\"font-weight: 400;\"> &#8212;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; using interface<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; Using Event Bus Such as Otto<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; Live data is the best way to manage the runtime changes of data and reflect that changes to UI<\/span><span style=\"font-weight: 400;\"> (recommended by Google)<\/span><\/p>\n<p><strong>Note:- MutableLive Data\u00a0 extends LiveData<\/strong><\/p>\n<p><strong>Q-Why we use Mutable live data?<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Ans-<\/strong>\u00a0 Mutable live data have a public getter and setter method, so it will easy to manipulate the data\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;\u00a0 Live data is an Observable data holder class that keeps data and allow data to be observed<\/span><\/p>\n<p><strong>Note -&gt;\u00a0 Observe LiveData from app components onCreate() method<\/strong><\/p>\n<p><strong>Benefits of LiveData:&#8211;<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&#8212;&gt;it keeps the UI updated in case of any changes<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&#8212;&gt;it automatically destroyed when associated LifeCycleOwner is destroyed<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8212;&gt;There is no crashes due to stopped activities\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0&#8212;&gt;it can be shared by multiple resources<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8212;&gt;It works efficiently when you used it with the view model<\/span><\/p>\n<p><img decoding=\"async\" class=\"wp-image-6775 size-full aligncenter\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-75.png\" alt=\"\" width=\"937\" height=\"642\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-75.png 937w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-75-300x206.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-75-768x526.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Screenshot-75-624x428.png 624w\" sizes=\"(max-width: 937px) 100vw, 937px\" \/><\/p>\n<p><strong>Note:- when you move from one activity to another activity the first activity observer stop observing the data<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6765 size-large\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/image4-1024x576.png\" alt=\"\" width=\"625\" height=\"352\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/image4-1024x576.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/image4-300x169.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/image4-768x432.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/image4-624x351.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/image4.png 1268w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">RoomDatabase:-<\/span><\/p>\n<pre class=\"lang:default decode:true \">\/\/room\r\n\u00a0 \u00a0 implementation \"androidx.room:room-runtime:2.2.5\"<\/pre>\n<p>&nbsp;<\/p>\n<h3><strong>SQLite Vs Room<\/strong><\/h3>\n<p><strong>SQLite:&#8212;<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; It Deals with raw queries<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; There\u00a0 is no Compile time verification of raw SQL queries<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; Lots of boilercode to convert between SQL queries and java data objects<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; SQLite API is low-level, so more time more effectively to build apps<\/span><\/p>\n<p><strong>Room:&#8211;<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;it has No raw queries<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; during Compile time it checks SQLite statements<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; it Maps database object and java objects without boilerplate code<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt; using of the room is efficient\u00a0 When we used it\u00a0 with ViewModel and live data<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><strong>\u00a0Q-What is Room?<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">Room database contains Database layer on top of SQLite, it provides an abstraction layer over SQLite to allow fluent database access, it works on object Relation Mapping library(ORM)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Benefits: &#8211; easy caching of relevant pieces of database<\/span><\/p>\n<p><strong>Components of Room:-<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;Entities<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; it defines the schema of the database table<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8211; Annotated with @Entity<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;DAO<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8211; it contains a method to access the database<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0&#8211; Annotated with @Dao<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;Database<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0-database holder class<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0-Annotated with @Database<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;Annotating the Java class with @Entity, room generate all the necessary code to create an SQLite table for this object,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;we can turn an integer member variable into an auto-incrementing primary key, By Columns for all, its fields. With @PrimaryKey\u00a0 and autoGenerate = true, from which we can use to uniquely identify each row in the table.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;We can also specify the tableName if it should be different than the class name.<\/span><\/p>\n<pre class=\"lang:default decode:true\">@Entity(tableName = \"users\")\r\n\r\npublic class User {\r\n\r\n\u00a0\u00a0\u00a0\u00a0@PrimaryKey\r\n\r\n\u00a0\u00a0\u00a0\u00a0public int id;\r\n\r\n\u00a0\u00a0\u00a0\u00a0@ColumnInfo(name = \"first_name\")\r\n\r\n\u00a0\u00a0\u00a0\u00a0public String firstName;\r\n\r\n\u00a0\u00a0\u00a0\u00a0@ColumnInfo(name = \"last_name\")\r\n\r\n\u00a0\u00a0\u00a0\u00a0public String lastName;\r\n\r\n}<\/pre>\n<p><span style=\"font-weight: 400;\"><br \/>\n@Entity:-generate all necessary code to create an SQLite table for this object as well as column for all this field<\/span><\/p>\n<pre class=\"lang:default decode:true \">UserList.java :------\r\n\r\n@Entity(tableName = \"user_entity\")\r\n\r\npublic class User{\r\n\r\n\u00a0\u00a0\u00a0\u00a0@PrimaryKey(autoGenerate = true)\r\n\r\n\u00a0\u00a0\u00a0\u00a0public \u00a0 int id;\r\n\r\n\u00a0\u00a0\u00a0\u00a0public String name;\r\n\r\n\u00a0\u00a0\u00a0\u00a0public Note(String name, String description, int jobNo) {\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0this.name= name;\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0this.description = description;\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0this.jobNo= jobNo;\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0public String description;\r\n\r\n\u00a0\u00a0\u00a0\u00a0public int jobNo;\r\n\r\n}<\/pre>\n<p><span style=\"font-weight: 400;\"><br \/>\n<strong>DAO:-<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;We define all database operation in DAO<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;we declare all operational method without method body, annotated with @insert,@Updates,@Delete<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;For generic, we declare it with @Query, we can pass an SQLite query with from it\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;The RoomDatabase works efficiently with live data because our activity or fragment gets notified as soon as a row in the queried database table changes.<\/span><\/p>\n<p><strong>Note: Room does not allow data operation on the main thread<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">UserDao.java :&#8212;&#8212;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">@Dao<\/span><\/p>\n<pre class=\"lang:default decode:true \">public interface UserDao {\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Insert\r\n\r\n\u00a0\u00a0\u00a0\u00a0void insert(User);\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Update\r\n\r\n\u00a0\u00a0\u00a0\u00a0void update(User details);\r\n\r\n\u00a0\u00a0\u00a0\u00a0\/\/we can also pass multiple argument\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Delete\r\n\r\n\u00a0\u00a0\u00a0\u00a0void delete(User user);\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Query(\"DELETE FROM user_entity\")\r\n\r\n\u00a0\u00a0\u00a0\u00a0void deleteAllUser();\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Query(\"SELECT *FROM user_entity ORDER BY priority DESC\")\r\n\r\n\u00a0\u00a0\u00a0\u00a0LiveData&lt;List&lt;User&gt;&gt;getAllUser();\r\n\r\n}<\/pre>\n<p><span style=\"font-weight: 400;\"><br \/>\n<strong>RoomDatabase:-<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;<\/span><span style=\"font-weight: 400;\"> RoomDatabase is an abstract class that acts as a bridge and connects the entities to their corresponding DAO. Just as in an SQLiteOpenHelper.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">-&gt;we have to define a version number and a migration strategy. With fallback To Destructive Migration, we can let Room recreate our database if we increase the version number.<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android architecture is defined as the, A Guide to android app architecture with libraries for a different task, it helps us to create an app that is robust, testable, maintainable, and has less boilerplate code, Architecture component is part of Android jetpack Android jetpack is collection of android software component like data binding, lifecycles, livedata, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6769,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[474,611,610,612],"class_list":["post-6752","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-android-architecture","tag-architecture-component","tag-benefits-of-livedata","tag-lifecycleaware-components"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Architecture - InnovationM - Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.innovationm.com\/blog\/android-architecture\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Architecture - InnovationM - Blog\" \/>\n<meta property=\"og:description\" content=\"Android architecture is defined as the, A Guide to android app architecture with libraries for a different task, it helps us to create an app that is robust, testable, maintainable, and has less boilerplate code, Architecture component is part of Android jetpack Android jetpack is collection of android software component like data binding, lifecycles, livedata, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/android-architecture\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-21T08:21:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-20T13:25:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Architecture-component.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"InnovationM Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InnovationM Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"Android Architecture\",\"datePublished\":\"2021-04-21T08:21:54+00:00\",\"dateModified\":\"2023-01-20T13:25:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/\"},\"wordCount\":999,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/Architecture-component.png\",\"keywords\":[\"Android Architecture\",\"Architecture component\",\"Benefits of LiveData\",\"LifeCycleAware components\"],\"articleSection\":[\"Android\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/\",\"name\":\"Android Architecture - InnovationM - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/Architecture-component.png\",\"datePublished\":\"2021-04-21T08:21:54+00:00\",\"dateModified\":\"2023-01-20T13:25:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/Architecture-component.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/Architecture-component.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/android-architecture\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android Architecture\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\",\"name\":\"InnovationM Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"caption\":\"InnovationM Admin\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/innovationmadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Architecture - InnovationM - Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.innovationm.com\/blog\/android-architecture\/","og_locale":"en_US","og_type":"article","og_title":"Android Architecture - InnovationM - Blog","og_description":"Android architecture is defined as the, A Guide to android app architecture with libraries for a different task, it helps us to create an app that is robust, testable, maintainable, and has less boilerplate code, Architecture component is part of Android jetpack Android jetpack is collection of android software component like data binding, lifecycles, livedata, [&hellip;]","og_url":"https:\/\/www.innovationm.com\/blog\/android-architecture\/","og_site_name":"InnovationM - Blog","article_published_time":"2021-04-21T08:21:54+00:00","article_modified_time":"2023-01-20T13:25:05+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Architecture-component.png","type":"image\/png"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"Android Architecture","datePublished":"2021-04-21T08:21:54+00:00","dateModified":"2023-01-20T13:25:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/"},"wordCount":999,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Architecture-component.png","keywords":["Android Architecture","Architecture component","Benefits of LiveData","LifeCycleAware components"],"articleSection":["Android"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/android-architecture\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/","url":"https:\/\/www.innovationm.com\/blog\/android-architecture\/","name":"Android Architecture - InnovationM - Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Architecture-component.png","datePublished":"2021-04-21T08:21:54+00:00","dateModified":"2023-01-20T13:25:05+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/android-architecture\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Architecture-component.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2021\/04\/Architecture-component.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/android-architecture\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Android Architecture"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed","name":"InnovationM Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","caption":"InnovationM Admin"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/innovationmadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/6752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=6752"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/6752\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/6769"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=6752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=6752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=6752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}