Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore CU-MCA-Mobile Applications Development Second draft-converted

CU-MCA-Mobile Applications Development Second draft-converted

Published by Teamlease Edtech Ltd (Amita Chitroda), 2021-05-04 06:33:44

Description: CU-MCA-Mobile Applications Development Second draft-converted

Search

Read the Text Version

3. What is the HTTP response error code status in android? a. status code < 100 b. status code > 100 c. status >= 400 d. None of these 4. What is the JSON exception in android? a. JSon Exception b. Json Not found exception c. Input not found exception d. None of these 5. How to find the JSON element length in android JSON? a. count() b. sum() c. add() d. length() Answers 1-c, 2-d. 3-c, 4-a, 5-d, 12.10 REFERENCES Reference Books ● Khoshafian, et al. (1990). Object orientation: Concepts, Languages, Databases. New York: John Wiley & Sons ● Thornsby, J. (May 2016). Android UI Design. Packt Publishing. ● Morris, J. (Feb 2011). Android User Interface Development - Beginner’s Guide. UK. Packt Publishing Websites 301 CU IDOL SELF LEARNING MATERIAL (SLM)

• https://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-UI-Design.pdf • https://www.techotopia.com/index.php/Understanding_Android_Views,_View_Gr oups_and_Layouts • https://www.tutorialspoint.com/software_architecture_design/user_interface.htm • https://www.wideskills.com/android/building-user-interface/listening-to-ui- notifications-in-android • https://developer.android.com/guide/fragments/lifecycle 302 CU IDOL SELF LEARNING MATERIAL (SLM)

UNIT - 13: ANDROID WEB-SERVICES Structure 13.0.Learning Objectives 13.1. Introduction 13.2. SOAP vs. Restful API’s 13.3. Picasso 13.4. Summary 13.5. Keywords 13.6. Learning Activity 13.7. Unit End Questions 13.8. References 13.0 LEARNING OBJECTIVES After studying this unit, you will be able to: • Explain implementation of web service in Android • Explain SOAP • Differenciate between SOAP and restful API • Use Picasso • Brief Activities 13.1 INTRODUCTION Creating internet service packages in android isn't always a tough task. We can without difficulty create a restful internet service software in android to authenticate or shop the facts into the outside database along with Oracle, MySQL, PostgreSQL, SQL server the usage of different packages evolved in java, .internet, PHP, and so forth languages. That is what we're going to do. Before growing internet offerings packages, you need to have primary information of SOAP and Restful internet offerings. That is why we're going to speak about primary factors approximately internet offerings along with what's internet provider and short facts approximately SOAP and Restful internet offerings. An internet provider is a fashionable for changing facts among unique kinds of packages no matter language and platform. For instance, an android software can have interaction with java or .net software the usage of internet services. 13.2 SOAP VS. RESTFUL API’S SOAP? 303 CU IDOL SELF LEARNING MATERIAL (SLM)

SOAP is a protocol that turned into designed earlier than REST and got here into the picture. The important concept in the back of designing SOAP turned into to make sure that packages constructed on unique systems and programming languages may want to alternate records in an clean manner. SOAP stands for Simple Object Access Protocol. REST? REST turned into designed particularly for working with additives along with media additives, files, or maybe gadgets on a selected hardware device. Any internet provider this is described at the concepts of REST may be known as a RestFul internet provider. A Restful provider could use the regular HTTP verbs of GET, POST, PUT and DELETE for running with the specified additives. REST stands for Representational State Transfer. DIFFERENCE • SOAP stands for Simple Object Access Protocol while REST stands for Representational State Transfer. • SOAP is a protocol while REST is an architectural pattern. • SOAP makes use of provider interfaces to show its capability to client packages whilst REST makes use of Uniform Service locators to get entry to the additives at the hardware device. • SOAP wishes greater bandwidth for its utilization while REST doesn’t want lots bandwidth. • SOAP best works with XML formats while REST paintings with simple text, XML, HTML, and JSON. • SOAP can't make use of REST while REST can employ SOAP. Difference Between SOAP and REST Each method has its very own benefits and disadvantages. Hence, it is usually exact to recognize wherein conditions every layout need to be used. This educational will move into a number of the important thing variations among those strategies in addition to what demanding situations you would possibly come across whilst the usage of them. Below are the principle variations among SOAP and REST. Below are the main differences between SOAP and REST SOAP REST • SOAP stands for Simple Object • REST stands for Representational State Access Protocol Transfer • SOAP is a protocol. SOAP turned • REST is an Architectural fashion into designed with a specification. wherein an internet provider can best be 304 CU IDOL SELF LEARNING MATERIAL (SLM)

It consists of a WSDL document handled as a RESTful provider if it that has the specified facts on what follows the restrictions of being the internet provider does similarly to the place of the internet 1. Stateless provider. 2. Client Server 3. Cacheable 4. Layered System 5. Uniform Interface • SOAP can't employ REST on • REST can employ SOAP because the account that SOAP is a protocol underlying protocol for internet and REST is an architectural offerings, due to the fact in the long run pattern. it's miles simply an architectural pattern. • SOAP makes use of provider • REST use Uniform Service locators to interfaces to show its capability to get entry to the additives at the hardware customer packages. In SOAP, the device. WSDL document presents the customer with the essential facts which may be used to recognize what offerings the internet provider can offer. • SOAP requires more bandwidth • REST does not need much bandwidth for its usage. Since SOAP when requests are sent to the server. Messages contain a lot of REST messages mostly just consist of information inside of it, the JSON messages. Below is an example of amount of data transfer using a JSON message passed to a web server. SOAP is generally a lot. You can see that the size of the message is comparatively smaller to SOAP. <?xml version=\"1.0\"?> <SOAP-ENV:Envelope {\"city\":\"Mumbai\",\"state\":\"Maharastra\"} xmlns:SOAP-ENV =\"http://www.w3.org/2001/12/soap- envelope\" SOAP-ENV:encodingStyle =\" http://www.w3.org/2001/12/soap- encoding\"> <soap:Body> <Demo.guru99WebService xmlns=\"http://tempuri.org/\"> <EmployeeID>int</EmployeeID> 305 CU IDOL SELF LEARNING MATERIAL (SLM)

</Demo.guru99WebService> • REST lets in unique records layout </soap:Body> along with Plain text, HTML, XML, </SOAP-ENV:Envelope> JSON, and so forth. But the maximum favoured layout for moving records is • SOAP can only work with XML JSON. format. As seen from SOAP messages, all data passed is in XML format. Table 13.1 differences between SOAP and REST 13.3 PICASSO Android Picasso is an picture loading/processing library evolved and maintained with the aid of using Square Inc. It’s immensely famous because it frequently calls for simply one line of code and has a comparable fashion of coding for every of its capabilities(we’ll be imposing them soon!). To use the android Picasso Library on your Android Studio project, upload the subsequent dependency on your build. Gradle document. Android Picasso comes with its very own set of capabilities along with: 1. Resizing and Scaling 2. Center Cropping 3. Rotation and Transformation four. Setting the Placeholder and Error images 5. Fading 6. Disk and Memory Caching 7. Priority Requests 8. Support for Request cancellation and parallel downloading Android Picasso – Loading picture from URL To load an picture from a URL in an ImageView the usage of picassoapi, the subsequent code snippet is generally used. Picasso.with(context).load(\"https://cdn.journaldev.com/wp-content/uploads/2016/11/android- picture-picker-project-structure.png\").into(imageView) Android Picasso – Loading a resource 306 CU IDOL SELF LEARNING MATERIAL (SLM)

To load a resource (drawable/mipmap): Picasso.with(context).load(R.mipmap.ic_launcher).into(imageView); Android Picasso – Loading picture from File To load a document picture : File document = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURE S), \"Sample.jpg\"); Picasso.with(context).load(document).into(imageView); Android Picasso Caching 1. Memory Policy Picasso with the aid of using default attempts to get an picture from the reminiscence first. To save you this we are able to upload the approach noMemoryPolicy() with the aid of using calling both or each of the enums MemoryPolicy.NO_CAHE, MemoryPolicy.NO_STORE. o Memory.NO_CACHE is used to save you loading the picture from the saved cache. o Memory.NO_STORE is used to now no longer keep the picture withinside the cache at all. Typically used if we want the picture one unmarried time. Picasso.with(context).load(image_url).memoryPolicy(MemoryPolicy.NO_CACHE).into(ima geView); Picasso.with(context).load(image_url).memoryPolicy(MemoryPolicy.NO_STORE).into(ima geView); 2. Network Policy If the picture isn't always served/avoided from the Memory, Picasso subsequent attempts to get it from the Disk Cache. To bypass the disk cache we want to name the approach .networkPolicy() with the parameter set as NetworkPolicy.NO_CACHE Another beneficial enum is NetworkPolicy.OFFLINE which could test for the picture withinside the cache best. It’ll display the mistake picture(if described) or clean if the picture isn't always discovered withinside the cache. Picasso. With (context).load(image_url).networkPolicy(NetworkPolicy.NO_CACHE).into(imageView); 307 CU IDOL SELF LEARNING MATERIAL (SLM)

13.4 SUMMARY • A net service is largely required to offer interoperability, i.e. connecting diverse packages. It lets in specific apps to speak with every different and percentage the statistics and offerings amongst themselves. Web offerings offer a trendy for all sorts of client packages to invoke capabilities on each kind of app server. For example, you could bear in mind an android software interacting with a .NET app the use of a web carrier. • Provided under is the easy depiction of ways a Web Server virtually works. It has vital matters which might be the Client and the Server. Here first the Client makes a request from the Server and then, the Server makes a reaction to the Client. • Android Web Services Components • The web server structure normally carries the subsequent 3 roles- • Publisher • The writer may be understood as a Service provider. The writer is answerable for developing the net carrier and making it to be had for the Clients. • Subscriber • The Subscriber is not anything but, the carrier requester. The Service requester is the only that desires to touch the net carrier. The customer software will touch thru a customer software. This Client software may be primarily based totally on .Net or any language-primarily based totally language. • Broker • The broking right here is the software that gives get entry to the UDDI. The UDDI stands for User descriptive, discovery, and integration. It permits the customer software to discover the net carrier exactly. 13.5 KEYWORDS • SOAP- SOAP (formerly an acronym for Simple Object Access Protocol) is a messaging protocol specification for exchanging structured information in the implementation of web services in computer networks. • Restful API’s- A RESTful API is an architectural style for an application program interface (API) that uses HTTP requests to access and use data. • Picasso- A powerful image downloading and caching library for Android. Introduction. Images add much-needed context and visual flair to Android applications • JSON stands for JavaScript Object Notation. • Activities 308 CU IDOL SELF LEARNING MATERIAL (SLM)

• WSDL file- WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure- oriented information. 13.6 LEARNING ACTIVITY 1. Implement the following using web services Figure 13.1: Implwmwnt web service ___________________________________________________________________________ ____________________________________________________________________ 13.7 UNIT END QUESTIONS A. Descriptive Questions 309 Short Questions 1. What is Web Service? 2. How does an internet provider work? 3. What are the advantages of web services? 4. What are the specific varieties of web services? CU IDOL SELF LEARNING MATERIAL (SLM)

5. What is SOAP? 6. What are the benefits of SOAP web services? Long Questions 1. Explain implementation of web service in Android 2. Explain SOAP 3. Differenciate between SOAP and restful API 4. What is the Use of Picasso 5. How Android web services can be implemented in smoother way? B. Multiple Choice Questions 1. _______________ is used to convert your application into Web-Application. a. Java Service b. Browser Action c. Web Services d. Struts Services 2. Web Services are _______________. a. Application Designing Tool b. Application IDE c. None of these d. Application Components 3. The basic Web Services platform is combination of _____ and _______. 310 a. CSS + JAVA b. CSS + HTTP c. XML + HTTP d. XML + HTML CU IDOL SELF LEARNING MATERIAL (SLM)

4. Web services communicate using __________. a. Open protocols b. Open-Close protocols c. None of these d. Close protocols 5. Web services are self-contained and self-describing ! (True / False) a. False b. True 6. Web services can be discovered using ________. a. UDDII b. UDDI c. UDII d. UDDDI 7. __________ is the basis for Web services. a. PHP b. CSS c. CGI d. XML 8. Which of the following is considered as Web Service Platform Elements ? 311 a. SOAP b. All of these c. UDDI CU IDOL SELF LEARNING MATERIAL (SLM)

d. WSDL 9. WSDL Stands for ______________________. a. Web Services Description Language b. Web Services Design Language c. None of these d. Web Services Development Language 10. UDDI Stands for ______________________. a. Universal Development, Design and Integration b. None of these c. Universal Description, Discovery and Integration d. Universal Description, Development and Integration Answers 1-c, 2-d. 3-c, 4-a, 5-b, 6-b, 7-d,8-c,9-a,10-c 13.8 REFERENCES Reference Books ● Khoshafian, et al. (1990). Object orientation: Concepts, Languages, Databases. New York: John Wiley & Sons ● Thornsby, J. (May 2016). Android UI Design. Packt Publishing. ● Morris, J. (Feb 2011). Android User Interface Development - Beginner’s Guide. UK. Packt Publishing Websites • https://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-UI-Design.pdf 312 CU IDOL SELF LEARNING MATERIAL (SLM)

• https://www.techotopia.com/index.php/Understanding_Android_Views,_View_Gr oups_and_Layouts • https://www.tutorialspoint.com/software_architecture_design/user_interface.htm • https://www.wideskills.com/android/building-user-interface/listening-to-ui- notifications-in-android • https://developer.android.com/guide/fragments/lifecycle 313 CU IDOL SELF LEARNING MATERIAL (SLM)

UNIT - 14: DEPLOYMENT Structure 14.0 Learning Objectives 14..1 Introduction 14..2 Adding External Jar 14..3 Creating Jar Files 14..4 putting app on the market 14..5 Summary 14..6 Keywords 14..7 Learning Activity 14..8 Unit End Questions 14..9 References 14.0 LEARNING OBJECTIVES After studying this unit, you will be able to: • Describe how to deploy application developed in Android • Learn Jar files • Explain working with Jar files • Create Jar files • Describe how to place app on the market 14.1 INTRODUCTION Your Android app is deployed while you run it on an Android goal device. You also can use the Deployment Manager to control the deployed documents. After your Android software is prepared for very last deployment, you could continue to construct and signal your software. You have to configure numerous alternatives in your Android app earlier than you construct the software for distribution. The residences which you configure are bundled together along with your software, withinside the AndroidManifest.xml record. You cannot alter those residences when you construct and signal your software. Because those residences offer key records approximately your software, you ought to make certain that they comprise the best values earlier than you install your software, or you may must rebuild your software which will extrude the configured values. 314 CU IDOL SELF LEARNING MATERIAL (SLM)

Before every launch of your Android software, you ought to take a look at that each putting is well configured. To configure your Android app: • On the Project > Options > Application page, offer the icons and pix to symbolize your software. • On the Project > Options > Version Info page, growth the model code of your software. Application shops along with Google Play can also additionally require that more recent variations of your software continually have a better model code than preceding variations. • On the Project > Options > Uses Permissions page, outline the permissions that your software calls for to work. • On the Project > Options > Provisioning page, pick out in Target the construct configuration which you need to apply to install your software (for example, Release) and offer a KeyStore record when you have now no longer already created one. This step is important which will deployation your software on a tool that has USB debugging disabled and to distribute your software to others. For greater records approximately Keystore documents, see http://docs.oracle.com/javase/1.5.0/docs/api/java/security/KeyStore.html. Customizing Your AndroidManifest.xml File RAD Studio writes the alternatives of your Android software to a unique Android record, AndroidManifest.xml, that is protected for your very last Android bundle while you install your software for Android. This record defines matters along with the model code or show call of your software, the listing of permissions that your software calls for, and so on. Usually, you do now no longer want to the touch this record, and you could permit RAD Studio cope with the entirety for you. However, RAD Studio permits you to personalize the content material of the AndroidManifest.xml record in case you want to consist of custom records on this record which you can't outline visually for your venture alternatives. When you construct an software for the Android goal platform for the primary time, RAD Studio provides a record for your venture folder: AndroidManifest.template.xml. Whenever you construct your software for Android, RAD Studio reads this record, replaces a few placeholders withinside the record with real values out of your venture alternatives, and writes the ensuing content material into an output record: AndroidAndroidManifest.xml. This output record is the AndroidManifest.xml record this is protected withinside the Android bundle that RAD Studio generates while you install your software for the Android goal platform. To personalize the output AndroidManifest.xml record of a unmarried venture, edit the content material of AndroidManifest.template.xml. 315 CU IDOL SELF LEARNING MATERIAL (SLM)

14.2 ADDING EXTERNAL JAR Basically, JAR is a Java Archives Package record, which incorporates numerous Java files to acquire a selected task. The metadata and Resources (text, pix, etc.) also are comprised inside a record to distribute it as Library files. All JAR files are archived record that is constructed on Zip format. JAR documents have them. JAR extension. You can upload those JAR files for your libs folder below the app folder to offer your venture a few extra functionality. Let's see the steps worried in uploading or including a JAR record in Android Studio: How to import or Add External JAR files in Android Studio: Step 1: Download any JAR file in your Project. For Example Download three Mail dependency JAR files for Android Studio. Figure 14.1: Downloading jar files Step 2: Download all 3 JAR files someplace for your system. Step 3: Copy those three Files from that folder in which you downloaded them, and Paste them withinside the libs folder below the app folder of your project. 316 CU IDOL SELF LEARNING MATERIAL (SLM)

Figure 14.2: Application Folder Important Note: If you aren't capable of discover libs you then definately have to be viewing your project withinside the “Android” view. On the proper aspect of the Android tab, you may see the symbol. Click on it and pick out Project. Figure 14.3: Viewing project If you're the use of an older model in which you could’t discover this, you then definately actually want to click on at the Android tab and it's going to display you a drop-down listing from that listing pick out project. Now paste jar files here in libs folder 317 CU IDOL SELF LEARNING MATERIAL (SLM)

Figure 14.4: Placing Jar Files Step 4: Once your JAR files are successfully copied to libs folder, add them as dependency files. Step 5: Click on File > Project Structure >Select app > Dependencies Tab. Figure 14.5: Dependencies Tab Step 6: Click on (+) plus button given on right side and select File Dependency. 318 CU IDOL SELF LEARNING MATERIAL (SLM)

Figure 14.6: File dependency Step 7: This will pop up a dialog box for selecting path Figure 14.7: Setting Path Steps 8: Once you select all three Jar files then click ok. 319 CU IDOL SELF LEARNING MATERIAL (SLM)

Figure 14.8: Selecting jar files This manner you want to manually upload whatever withinside the construct.gradle record. After of entirety of Gradle building, the entirety may be accomplished and you're prepared to apply your External JAR Library. [cp_modal display=\"inline\" id=\"cp_id_e19ea\"][/cp_modal] 14.3 CREATING JAR FILES The primary layout of the command for developing a JAR record is: jar cfjar-record enter-record(s) The alternatives and arguments used on this command are: • The c choice shows which you need to create a JAR record. • The f choice shows which you need the output to visit a record in preference to stout. • jar-record is the call which you need the ensuing JAR record to have. You can use any filename for a JAR record. By convention, JAR filenames are given a .jar extension, aleven though this isn't always required. • The enter-record(s) argument is an area-separated listing of 1 or greater documents which you need to encompass for your JAR record. The enter-record(s) argument can include the wildcard * symbol. If any of the \"enter documents\" are directories, the contents of these directories are introduced to the JAR archive recursively. 320 CU IDOL SELF LEARNING MATERIAL (SLM)

The c and f alternatives can seem in both order, however there should now no longer be any area among them. This command will generate a compressed JAR record and region it withinside the cutting- edge directory. The command will even generate a default happen record for the JAR archive. Note: The metadata withinside the JAR record, including the access names, comments, and contents of the happen, should be encoded in UTF8. You can upload any of those extra alternatives to the cf alternatives of the primary command:: jar command options Option Description Produces verbose output on stdout at the same time as the JAR record is being built. v The verbose output tells you the call of every record as it is added to the JAR record. 0 (zero) shows which you do not need the JAR record to be compressed. M Indicates that the default happen record need to now no longer be produced. Used to encompass happen facts from an present happen record. The layout for the use of this feature is: jar cmfjar-record present-happen enter-record(s) m Warning: The happen should give up with a brand new line or carriage return. The closing line will now no longer be parsed nicely if it does now no longer give up with a brand new line or carriage return. To alternate directories at some point of the execution of the command. See under -C for an example.. Note: When you create a JAR record, the time of introduction is saved withinside the JAR record. Therefore, although the contents of the JAR record do now no longer alternate, whilst you create a JAR record more than one times, the ensuing documents aren't precisely identical. You need to be privy to this whilst you are the use of JAR documents in a construct environment. It is suggested which you use versioning facts withinside the happen record, in preference to introduction time, to govern variations of a JAR record. 321 CU IDOL SELF LEARNING MATERIAL (SLM)

14.4 PUTTING APP ON THE MARKET Any app submitted to the Android Market is obtainable to each person with an Android cellphone or tablet. Users who're inquisitive about the app can down load and deployation it without delay from their Android tool. Anyone with an Android Developer account can add an app to the Market. A registration price is needed to enroll in a developer account. Your app should be signed with a cryptographic private key, should outline each the android:versionCode and android:versionName attributes withinside the element, and should outline an android: icon and android: label withinside the element. 1Navigate to the Android Market publisher webweb page at Market.android.com/put up. 2Sign in the use of a Google Account. 3Sign up for an Android Developer account. 4Click at the \"Choose File\" button beneathneath the Application .apk File phase and pick out the APK record from the record browser that appears. Click at the \"Upload\" button on this phase to add the record. 5Click the \"Choose File\" button beneathneath the Screenshots phase and pick out one of the screenshots which you need to encompass from the record browser. Click at the \"Upload\" button on this phase to add the screenshots. 6. Click at the \"Choose File\" button beneathneath the Promotional Graphics phase to add any extra promotional graphics. Click at the \"Upload\" button on this phase to add the graphics. 7. Type the title, description, type, category, and rate in your app in the perfect textual content boxes beneathneath the Listing Details phase. 8Click on the perfect reproduction safety and vicinity options beneathneath the Publishing Options phase. 9Type for your internet site address, email, and speak to range in the perfect textual content boxes beneathneath the Contact Information phase. 10Click at the \"I Agree\" button to conform to the Android Market phrases of the agreement. 11Click at the \"Publish\" button to put up the app at the Android Market. 14.5 SUMMARY • Your Android app is deployed whilst you run it on an Android goal tool. You also can use the Deployment Manager to control the deployed documents. After your Android utility is prepared for very last deployment, you may continue to construct and signal your utility • You should configure numerous alternatives in your Android app earlier than you construct the utility for distribution. The homes which you configure are bundled 322 CU IDOL SELF LEARNING MATERIAL (SLM)

together along with your utility, withinside the AndroidManifest.xml record. You cannot alter those homes when you construct and signal your utility. Because those homes offer key facts approximately your utility, you need to make sure that they include the right values earlier than you set upation your utility, or you may must rebuild your utility so as to alternate the configured values. • Before every launch of your Android utility, you need to take a look at that each putting is nicely configured. To configure your Android app: • On the Project > Options > Application page, offer the icons and photographs to symbolize your utility. • On the Project > Options > Version Info page, boom the model code of your utility. Application shops including Google Play can also additionally require that more modern variations of your utility usually have a better model code than preceding variations. • On the Project > Options > Uses Permissions page, outline the permissions that your utility calls for to work. • On the Project > Options > Provisioning page, pick in Target the construct configuration which you need to apply to set upation your utility (for example, Release) and offer a KeyStore record when you have now no longer already created one. This step is important so as to deployation your utility in a tool that has USB debugging disabled and to distribute your utility to others. For greater facts approximately Keystore documents, see http://docs.oracle.com/javase/1.five.0/docs/api/java/security/KeyStore.html. • RAD Studio writes the alternatives of your Android utility to a unique Android record, AndroidManifest.xml, that's covered for your very last Android package deal whilst you set upation your utility for Android. This record defines matters including the model code or show call of your utility, the listing of permissions that your utility calls for, and so on. In this chapter, you discovered that deploying to an Android tool in all fairness simple. You configure the tool to just accept non-marketplace apps. Then, you simply want to get the APK record to the checking out tool. You can do this thru Studio, ADB, an ad-hoc distribution technique like an internet page, or thru a framework. 14.6 KEYWORDS • Deployment Manager - allows you to specify all the resources needed for your application in a declarative format using yaml. • RAD Studio - The Most Powerful IDE For Building Native Apps on Windows, Android, iOS, macOS and Linux · 323 CU IDOL SELF LEARNING MATERIAL (SLM)

• External Jar- A JAR (Java Archive) is a package file format typically used to aggregate many Java class files and associated metadata and resources. • Archives Package file- A class archive package, which is an enhancement to the Application Binary Interface (ABI), is one in which certain sets of files have been combined into single. • Dependencies- A dependency describes the relationship among activities and specifies the particular order in which they need to be performed. 14.7 LEARNING ACTIVITY 1. Develop an App of your very own preference and set upation it directly to the marketplace Place. ___________________________________________________________________________ _____________________________________________________________ 14.8 UNIT END QUESTIONS A. Descriptive Questions Short Questions 1. JAR files. 2. Libs folder 3. Android Enterprise 4. App market place 5. Deployment Long Questions 1. How many devices do I want to join Android Enterprise? 2. What do you want to realize approximately Android devices? 3. How can I absolutely control my Android tool with Intune? 4. How to import or upload outside JAR files in Android Studio? 5. How to feature JAR files to the LIBS folder? 6. How to generate JAR files? 7. What is Android SDK and the way does it work? 8. Write steps for placing App on market. B. Multiple Choice Questions 324 CU IDOL SELF LEARNING MATERIAL (SLM)

1. A type of service provided by android that allows sharing and publishing of data to other applications is a. View System b. Content Providers c. Activity Manager d. Notifications Manager 2. The android library that provides access to UI pre-built elements such as buttons, lists, views etc. is a. android.text b. android.os c. android.view d. android.webkit 3. The android component that manages the app's configuration file is called a.manifest b.fragment c.view d.intent 4. The tab that shows system and error messages is 325 a.terminal b.messages c.TODO d.Comments 5. Web services can be discovered using ________ a. UDDII CU IDOL SELF LEARNING MATERIAL (SLM)

b. UDDI c. UDII d. UDDDI Answers 1-d, 2-a. 3-b, 4-b 5. b 14.9 REFERENCES Reference Books ● Khoshafian, et al. (1990). Object orientation: Concepts, Languages, Databases. New York: John Wiley & Sons ● Thornsby, J. (May 2016). Android UI Design. Packt Publishing. ● Morris, J. (Feb 2011). Android User Interface Development - Beginner’s Guide. UK. Packt Publishing Websites • https://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-UI-Design.pdf • https://www.techotopia.com/index.php/Understanding_Android_Views,_View_Gr oups_and_Layouts • https://www.tutorialspoint.com/software_architecture_design/user_interface.htm • https://www.wideskills.com/android/building-user-interface/listening-to-ui- notifications-in-android • https://developer.android.com/guide/fragments/lifecycle 326 CU IDOL SELF LEARNING MATERIAL (SLM)

UNIT - 15: UPDATING EXISTING DEPLOYED APPLICATION Structure 15.0 Learning Objectives 15..1Updating existing deployed application 15..2Summary 15..3Keywords 15..4Learning Activity 15..5Unit End Questions 15..6References 15.0 LEARNING OBJECTIVES After studying this unit, you will be able to know: • Updating existing deployed application • Various Steps for updation • Precautions while updation • Make changes to your configuration • Make the update request 15.1 UPDATING EXISTING DEPLOYED APPLICATION After you've got created a deployment, you could replace it as your utility or service modifications. You can use Deployment Manager to replace deployment through: • Adding or casting off assets from a deployment. • Updating the homes of present assets in a deployment. A unmarried replace can include any mixture of those modifications. For instance, you could make modifications to the homes of present assets and upload new assets withinside the identical request. You replace your deployment through following those steps: 1. Make modifications to or create a configuration record with the modifications you need. 2. Optionally, select out the regulations to apply to your updates or use the default regulations. three. Make the replace request to the Deployment Manager. 327 CU IDOL SELF LEARNING MATERIAL (SLM)

Before you begin • If you need to apply the command-line examples on this guide, set up the `gcloud` command-line device. • If you need to apply the API examples on this guide, installation API access. • Understand a way to create deployments. Prepare your replace Before updating your deployment, use those pointers to put together the replace: • If you're updating your deployment to feature new assets in your venture, test whether or not the assets exist already. By default, if an aid which you need to feature already exists on your venture, it's far obtained through the deployment, without developing a brand new aid. If you do now no longer need to collect an present aid, you ought to alternate the coverage to apply for the replace. For facts at the regulations you could use at the same time as updating deployments you're updating your deployment to update a aid, test its dependencies If you need to update a aid out of your deployment, you ought to first make certain that deleting it would not motive a deployment cycle. A deployment cycle happens while a aid relies upon on itself, both at once or indirectly. For instance, bear in mind the subsequent deployment: assets:- call: vm-a properties: zone: us-central1-f ... metadata: dependsOn: - vm-depends-on # The second VM - call: vm-depends-on properties: zone: $(ref.vm-a.zone) ... 328 CU IDOL SELF LEARNING MATERIAL (SLM)

In this deployment, for vm-a, the dependsOn declaration calls for that vm-depends-on ought to be created earlier than vm-a. However, vm-depends-on makes use of a connection with the region for vm-a, which calls for that vm-a ought to be created earlier than vm-depends-on. In this type of scenario, the dependencies are in a loop, and the deployment fails. If you've got a aid that each depends on and is depending on through different assets, changing that aid may motive a deployment cycle. For instance, bear in mind a deployment that has a chronic disk referred to as disk-a, a VM referred to as vm-a, and an example institution referred to as ig-a. The configuration for vm-a consists of a connection with disk-a, and the configuration for ig-a consists of a connection with vm-a. In an up to date configuration, you need to get rid of vm-a and update it with vm- b. In this type of scenario, resolving the dependencies for vm-a and vm-b can motive a deployment cycle, and your deployment fails. To keep away from deployment cycles while you need to update a aid in a series of dependencies, do one of the following: • Remove the dependencies for the aid you need to update, both through casting off the depends On clause, or through casting off or converting references to different assets. After you've got up to date the deployment with those modifications, make any other replace to update the aid. • Delete the chain of based assets and replace the deployment. Then, withinside the subsequent replace, re-create the assets which you need to apply. • Ensure that there's an underlying API that helps your replace. Deployment Manager makes use of the APIs of every provider to create and regulate your deployments. To test that your request may be finished through the Deployment Manager, assessment the API documentation of the Cloud Platform provider for the assets which you need to replace. For instance, in case you need to replace a Big Query dataset on your deployment, see the to be had strategies withinside the Datasets API reference. The strategies encompass an replace approach, which shows that you could replace the dataset the usage of Deployment Manager. Some APIs have custom strategies for updating their assets. For instance, Compute Engine gives a custom approach for updating an example’s metadata referred to as set Metadata. In such cases, the Deployment Manager tries to apply the custom strategies. • Ensure that the assets you're updating are mutable. Some assets are immutable when they were created, and that they can't be up to date. To decide whether or not a aid is immutable, see the API reference for the aid. Typically, an immutable aid lacks an replace API approach or a custom approach to replace the homes of the aid. 329 CU IDOL SELF LEARNING MATERIAL (SLM)

Limitations • For every deployment, you could observe one replace at a time. If an replace is already in development, you ought to prevent the present day replace earlier than beginning a brand new replace. • If you changed a aid in deployment with out the usage of Deployment Managers, together with withinside the Cloud Console or gcloud, you would possibly see mistakes or surprising problems while you try and regulate the aid in an replace. Make modifications in your configuration If you stored an present configuration, make modifications to the configuration and use that during your replace request. If you do now no longer have an present configuration stored, create a brand new configuration. For steps to create a configuration record Deployment Manager compares the configuration you offer on your replace request to the preceding occur and use the variations to replace your deployment. For instance, the subsequent desk suggests configurations: one describes an present deployment and one describes the favoured up to date nation of the deployment. You offer the up to date configuration and the Deployment Manager evaluates the variations and makes the precise updates. This instance updates an present example aid to encompass a few custom metadata and additionally provides a brand new digital system aid to the deployment. The components in formidable are variations among the templates. Note: For readability, the instance replaces URLs with placeholders. In practice, you want to offer URLs for those homes, together with the system type. Current template Updated template resources: resources: - name: vm-created-by-cloud-config - name: vm-created-by-cloud-config type: compute.v1.instance type: compute.v1.instance properties: properties: zone: us-central1-a zone: us-central1-a machineType: machine-type-url machineType: machine-type-url disks: disks: - deviceName: boot - deviceName: boot type: PERSISTENT type: PERSISTENT boot: true boot: true autoDelete: true initializeParams: 330 CU IDOL SELF LEARNING MATERIAL (SLM)

initializeParams: diskName: disk-created-by-cloud-config diskName: disk-created-by-cloud- sourceImage: image-url config networkInterfaces: sourceImage: image-url - network: network-url networkInterfaces: metadata: - network: network-url items: - key: 'oof' value: 'bar' - key: 'dev' value: 'vm' - name: a-new-vm type: compute.v1.instance properties: zone: us-central1-a machineType: machine-type-url - deviceName: boot type: PERSISTENT boot: true autoDelete: false initializeParams: diskName: a-new-vm-disk sourceImage: image-url networkInterfaces: - network: network-url (Optional) Determine the regulations to apply for the update Next, decide what regulations you need to apply for the update. The policy determines how your assets are up to date while you update the deployment. Note: If you need to look your up to date deployment earlier than committing any modifications, you could preview your configuration. Deployment Manager makes use of those default regulations: • The default policy for including assets is CREATE_OR_ACQUIRE. • The default policy for casting off assets is DELETE. • The default policy for updating assets is UPDATE. For facts on every policy, assessment the sections below. Policies for including assets 331 CU IDOL SELF LEARNING MATERIAL (SLM)

When including assets, you could select to create a brand new aid and upload it to deployment or you could collect an present aid: • CREATE_OR_ACQUIRE - [Default] Deployment Manager acquires assets that exist withinside the venture or creates assets in the event that they do now no longer exist. To collect a aid, the Deployment Manager tests your configuration for the homes of the aid you are attempting to create. If there's an present aid with the identical homes, the Deployment Manager acquires that aid as a part of your deployment. The homes that Deployment Manager tests depend upon the sort of aid you're developing and may encompass: • The call of the aid • The sort of the aid • The region or place of the aid, if applicable The homes are a part of the URL for purchasing API requests for the aid. To see which homes Deployment Manager makes use of to collect a aid, see the API documentation for the aid's GET approach. For instance, for Compute Engine instances, the request URL for instances. get approach consists of the resource ID (call on your configuration), region, and project. Note: If you need to collect a aid after which replace it, we endorse first imparting all of the present day homes of the aid, as in case you have been developing it. After the aid is obtained, to replace the aid, alternate the aid's homes on your configuration and run the replace command again. • CREATE - Deployment Manager creates resources that don't exist. If any of the resources on your configuration exist already withinside the project, the deployment fails. • ACQUIRE - Deployment Manager acquires assets that exist already, the usage of the identical standards as CREATE_OR_ACQUIRE. Use the ACQUIRE coverage when you have some of assets already on your venture, and need to control them together, as a unmarried deployment. In your template or configuration, you ought to offer the specified homes for those assets as in case you are developing them. If any of the assets on your configuration do now no longer exist withinside the venture, the deployment fails. Warning: Do now no longer collect assets which might be already a part of any other deployment. If you do, any modifications you're making to 1 deployment can motive surprising conduct with the assets withinside the different deployment. Policies for casting off assets Provide one of the following regulations for casting off assets: 332 CU IDOL SELF LEARNING MATERIAL (SLM)

• DELETE - [Default] This gets rid of any references to the aid from the deployment and deletes the underlying aid. This is everlasting and can't be undone, however you could recreate a brand new aid with the identical homes. • ABANDON - This gets rid of any references to the aid from the deployment however does now no longer delete the underlying aid. For instance, forsaking an example method that it's far eliminated from deployment however the example nonetheless exists so that it will use. The ABANDON coverage simplest applies while you delete complete assets, now no longer while you delete the homes of a aid, or replace a aid with new homes. If you need to maintain the homes of a aid, you ought to encompass the aid with all its unique homes on your up to date configuration. If you are the usage of a brand new configuration record to your replace, we endorse copying the aid's definition out of your unique configuration. Policies for updating an present aid If an UPDATE approach exists for updating present assets, the Deployment Manager makes use of that. Otherwise, if a custom approach exists, the Deployment Manager makes use of the custom approach. Deployment Manager helps custom strategies that use the verb set. For instance, setMetadata() is a legitimate custom approach, however addAccessConfigs() is now no longer. (Optional) Preview an up to date configuration You can preview the replace you need to make earlier than committing any modifications, with the gcloud command-line device or the API. The Deployment Manager service previews the configuration through increasing the whole configuration and developing \"shell\" assets. Deployment Manager does now no longer instantiate any real assets while you preview a configuration, supplying you with the possibility to look the deployment earlier than committing to it. gcloudAPI With the gcloud command-line device, make an replace request with the --preview parameter: gcloud deployment-supervisor deployments replace instance-deployment --config configuration-record.yaml --preview After previewing a deployment, you could absolutely set upation the configuration through making the identical PUT() request, omitting each the configuration and the preview query 333 CU IDOL SELF LEARNING MATERIAL (SLM)

parameter. Deployment Manager makes use of your final preview to carry out the replace. For instance: gcloud deployment-supervisor deployments replace instance-deployment For steps to make an replace request, If making a decision now no longer to keep with the replace, cancel the present day preview earlier than making any other replace or preview request. Cancel a preview After you preview an replace, you ought to determine in case you need to keep with the replace. If you do now no longer need to keep, or in case you need to apply a distinct configuration record to replace the deployment, cancel the present day preview. gcloudAPI With the gcloud command-line device, make a deployments cancel-preview request: gcloud deployment-supervisor deployments cancel-preview my-first-deployment Make the update request To carry out the update: gcloudAPI With the gcloud command-line tool, use the deployments update subcommand, imparting a brand new configuration and optionally, your update regulations. gcloud deployment-supervisor deployments update my-first-deployment --create-policy POLICY --delete-policy POLICY If you formerly previewed a configuration, miss the configuration, and Deployment Manager makes use of the final previewed configuration to carry out the update. gcloud deployment-supervisor deployments update my-first-deployment Stop an update You can prevent an update this is in development the usage of the prevent (). approach. This cancels any in addition development from a selected update however does now no longer undo any alternate that has already been made. 334 CU IDOL SELF LEARNING MATERIAL (SLM)

If you are attempting to cancel a preview With the gcloud command-line device, make a deployments prevent request: gcloud deployment-supervisor deployments prevent my-first-deployment 15.2 SUMMARY • You can both refresh the programs downloaded and brought in your Android system completely or clearly. Refreshing your programs offers you admittance to the maximum latest highlights and improves utility safety and dependability. • Note: If Google makes a decision an utility replace will restoration a primary safety weakness, we might also additionally make sure utility refreshes paying little thoughts to refresh settings withinside the utility or in your system. For greater data, if it is now no longer an excessive amount of trouble, see the Google Play Terms of Service. • Note: If you are using Google Play on a Chromebook, get a few solutions regarding utility refreshes here. • Update Android programs clearly • To clearly refresh programs in your Android system: • Open the Google Play Store utility Google Play. • Tap Menu and later on Settings. • Tap Auto-replace programs. • Select a choice: • Over any organization to refresh programs using both Wi-Fi or flexible facts. • Over Wi-Fi likely to refresh programs simply while related to Wi-Fi. • Note: If a file in your system has a sign-in blunder, programs might not refresh clearly. • Update singular Android programs therefore • To installation refreshes for man or woman programs in your system: • Open the Google Play Store utility Google Play. • Tap Menu and later on My programs and games. • Select the utility you want to refresh. • Tap More. • Tap Enable auto-replace. • The utility will refresh therefore while updates are free. To kill programmed refreshes, uncheck the case. • Update Android programs physically • To refresh programs independently or in mass using the Google Play Store utility in your mobileular phone: • pen the Google Play Store utility Google Play. 335 CU IDOL SELF LEARNING MATERIAL (SLM)

• Tap Menu and later on My programs and games. • Applications with an update handy are marked \"Update.\" You can likewise search for a selected utility. • Tap Update. • Note: Some programs require new concurs while they're refreshed. You might also additionally see a caution inquiring as to whether or not you well known the brand new concurs. 15.3 KEYWORDS • Deployment Manager- Deployment Manager allows infrastructure to be defined in configuration files. • Metadata- Metadata is data that describes other data. • API - API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. • Cloud Platform service- infrastructure as a Service (IaaS). IaaS provides users access to raw computing resources such processing power, data storage capacity, and networking, in the context of a secure data center. Platform as a Service (PaaS). • dataset - A data set (or dataset) is a collection of data. 15.4 LEARNING ACTIVITY 1. Try to upload and self-developed app on to google play store, and write the steps. _______________________________________________________________________________ _______________________________________________________ 2. Try to update the Application evolved withinside the preceding unit withinside the marketplace place. _______________________________________________________________________________ ___________________________________________________________ 15.5 UNIT END QUESTIONS A. Descriptive Questions Short Questions 1. What is play store? 2. How to upload app in play store? 3. How to update app in play store? 4. What is APK files? 5. How to make the update request? 336 CU IDOL SELF LEARNING MATERIAL (SLM)

Long Questions 1. Write steps for Updating existing deployed application 2. Explain how to make updationand what Precautions must be taken while updation? 3. What language is supported by Android for application? 4. Describe the policies to use for the update. 5. Write the different ways for updating application in market place. B. Multiple Choice Questions 1. Which of the following is the core module of Android for Internet computing? a. SQLite RDBMS b. SQL Server RDBMS c. OpenPL d. None of these 2. Point out the wrong statement. a. Google Chrome to Phone Extension sends links and information from a Chrome browser to an Android phone b. Voice Actions for Android is a voice command and speech recognition program c. Google Goggles is used for local search d. All of the mentioned 3. Which of the following Google Application can be found in Android? a. Google Translate b. Google Shopper c. My Tracks d. All of the mentioned 4. Which of the following has not included support for Adobe Flash or Java on its platform? a. Microsoft b. Apple c. Google d. None of these 337 CU IDOL SELF LEARNING MATERIAL (SLM)

5. Which of the following programming medium is used by MobileMe to create the appearance of a desktop application inside a browser? a. HTML b. DHTML c. Jquery d. All of these Answer 1-a, 2-c, 3-d, 4-b, 5-b 15.6 REFERENCES Reference Books ● Khoshafian, et al. (1990). Object orientation: Concepts, Languages, Databases. New York: John Wiley & Sons ● Thornsby, J. (May 2016). Android UI Design. Packt Publishing. https://www.oreilly.com/library/view/android-ui-design/9781785887420/ ● Morris, J. (Feb 2011). Android User Interface Development - Beginner’s Guide. UK. Packt Publishing https://www.oreilly.com/library/view/android-ui- design/9781785887420/ Websites • https://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-UI-Design.pdf • https://www.techotopia.com/index.php/Understanding_Android_Views,_View_Group s_and_Layouts • https://www.ts.com/software_architecture_design/user_interface.htm • https://www.wideskills.com/android/building-user-interface/listening-to-ui- notifications-in-android • https://developer.android.com/guide/fragments/lifecycle • https://developer.android.com/ • http://www.vogella.com/tutorials/android.html. • https://www.codementor.io/community/topic/android. • https://androidweekly.net/ • https://www.androidcentral.com/ • https://androiduipatterns.com/ • https://www.javatpoint.com/android-bluetooth-tutorial 338 CU IDOL SELF LEARNING MATERIAL (SLM)


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook