How do I install the map program on an android real machine without built-in Google map add-on?

Source: Internet
Author: User

 

If you want to install an app with Google map add-on the android real machine, you need Google map add-on to the real machine itself. How can we install an app with no built-in real machine?

 


Not all android real machines contain Google map add-on. To build Google map add-on, you need to discuss it with Google.
However, if we develop an android application that uses Google map add-on<Uses-library Android: Name = "com. Google. Android. Maps"/>), You will find that this program cannot be successfully installed on a real machine without a built-in Google map add-on. So what can we do to solve this problem?

There are two methods:

1) maintain two code branches:
One branch is for Android real machines with built-in Google map add-on, and the other branch is for Android real machines without built-in Google map add-on.
However, this will increase the maintenance cost, and careless users may install mismatched branches on their own machines, thus reducing the software friendliness.

2) keep only one code Branch:
A foreign Daniel pointed out that the <uses-library> tag also contains an unpublished attribute"Android: Required", You can set this attribute of the COM. Google. Android. Maps library to false, that is:

<! -- The "Android: required" attribute was added in API Level 5 (Android 2.0) --> <br/> <uses-library Android: Name = "com. google. android. maps "Android: required =" false "/>

This means that if Google map add-on is built on the target machine, the application can be used normally. If Google map add-on is not built on the target machine, the application can be installed successfully. However, developers need to determine whether Google map add-on is available in the code, for example:

Try {class. forname ("com. Google. Android. Maps. mapactivity");} catch (exception e) {toast. maketext (mainactivity. This, "Oop! Google map unavailable ", toast. length_short ). show (); return;} intent = new intent (); intent. setclass (mainactivity. this, mymapactivity. class); startactivity (intent );Reprinted from http://www.cnblogs.com/gansc23/archive/2011/02/28/1967207.html

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.