का उपयोग कर किसी भी एप्लिकेशन का परीक्षण नहीं कर सकता है। मुझे एक बहुत ही अजीब समस्या है, मैंने अपने एचटीसी वन वी का उपयोग 4.0.3 ओएस का उपयोग करके अपना आवेदन विकसित किया है। अब एप्लिकेशन मेरे और कुछ अन्य यादृच्छिक 2.2 और 2.3 और 4+ डिवाइस पर शानदार काम करता है लेकिन कुछ डिवाइसों पर उनके पास Google Playlayore होने के बावजूद एप्लिकेशन शुरू होता है और यह लोड होता है लेकिन उनके पर जीपीएसटोर होने के बावजूद अन्य पर नक्शा नहीं दिखाता है जीपीएसटोर/सेवा मौजूद नहीं है क्रैश।एवीडी AVD
मैंने एवीडी डेविस पर एप्लिकेशन का परीक्षण करने की कोशिश की लेकिन उनमें से कोई भी Google PlayStore इंस्टॉल नहीं है। मैंने उन पर जीपीएसटोर को धक्का देने के लिए Google Play on Android 4.0 emulator दृष्टिकोण की कोशिश की लेकिन कोई सफलता नहीं मिली।
मेरे droid एसडीके पूरी तरह से अद्यतन किया जाता है:
मुझे लगता है मैं जाँच अपने मुख्य गतिविधि में
साथ अपने आवेदन संकलन करता है, तो Google Play सेवा/स्टोर अगर GoogleMaps इस्तेमाल किया जा सकता का निर्धारण करने के मौजूद है :
public class Map extends FragmentActivity implements Observer
{
private MapAgent agent;
private Locator locator;
private Spinner spinner;
private Button gps;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Get a new instance of Locator agent
locator = new Locator();
// Register as Observer to Locator agent
locator.addObserver(this);
// Check if Internet connection is available
if(Services.connectivityServiceState(this))
{
// We have a working Internet connection
// Check if we have a GooglePS in operating mode
if(Services.playServiceState(this))
{
// Load the map
setContentView(R.layout.activity_map);
// Fetch dropdown list & gps button reference
spinner = (Spinner) findViewById(R.id.bankslist);
gps = (Button) findViewById(R.id.gpsbttn);
// Register event listener with gps button
gps.setOnClickListener(new GpsAction(this));
// Register event listener with spinner
spinner.setOnItemSelectedListener(new SpinnerAction());
// Fetch our map
agent = new MapAgent(this);
// Move map camera to initial position
agent.initialPosition();
} else {
// GooglePS is not in operating mode
Messages.playNotificationMessage(this);
}
} else {
// No Internet connection
// Prompt user to turn on WiFi or Mobile
Messages.internetConnectionRequestMessage(this);
}
}
GooglePlay सेवा की स्थिति की जांच करने वाली विधि मेरी सेवाओं में स्थित है। Java bellow:
public class Services
{
/**
* OPERATING CODES
*/
private static final int GPS_ERR_REQUEST = 9000;
/**
* Test device for GooglePlayServices, required for
* GoogleMaps API V2.
*
* @param Activity
* @result boolean
*/
public static boolean playServiceState(Activity context)
{
// Fetch GooglePS operating code
int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context);
// Check if GooglePS is operating
if(code == ConnectionResult.SUCCESS)
{
// We have GooglePS in working condition
return true;
}
// We have an error, check if it can be resolved by user
/*if(GooglePlayServicesUtil.isUserRecoverableError(code))
{
// We can solve this error pull up GooglePS guide dialog
Dialog guide = GooglePlayServicesUtil.getErrorDialog(code, context, GPS_ERR_REQUEST);
// Show the guide dialog
guide.show();
// Dispose of our activity
context.finish();
}*/
// We do not have GooglePS in operating mode
// solve error and retry
return false;
}
/**
* Tests devices Wi-Fi and Mobile network for a
* working Internet connection.
*
* @param Activity
* @return boolean
*/
public static boolean connectivityServiceState(Activity context)
{
// Fetch a CM instance
ConnectivityManager con = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
// Test both carriers for a working Internet connection
NetworkInfo wifi = con.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo mobi = con.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
// Check for Internet connection
if(wifi.isConnected() || mobi.isConnected())
{
// We have a working internet connection
return true;
}
// No internet connection
return false;
}
/**
* Test NETWORK service to determine if Google Location
* services are enabled or not.
*/
public static boolean networkServiceState(Activity context)
{
// Fetch a LM instance
LocationManager provider = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
// Return true for enabled GLS
return provider.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
}
/**
* Tests GPS service to determine if GPS
* is enabled or not.
*
* @param Activity
* @result boolean
*/
public static boolean gpsServiceState(Activity context)
{
// Fetch a LM instance
LocationManager provider = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
// Return true for enabled GPS
return provider.isProviderEnabled(LocationManager.GPS_PROVIDER);
}
/**
* Checks if a GPS Radio is present
* within the device.
*
* @param Activity
* @return boolean
*/
public static boolean hasGPS(Activity context)
{
// Refere to devices package manager for GPS service
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS);
}
}
और मेरा नक्शा बस मेरे मैपएजेंट क्लास में संभाला जाता है जो कुछ मार्करों को संभालने में प्रभावशाली नहीं है।
public MapAgent(FragmentActivity context)
{
// Fetch the map support fragment
SupportMapFragment fragment = ((SupportMapFragment) context.getSupportFragmentManager().findFragmentById(R.id.map));
// Fetch map and view
map = fragment.getMap();
// Set initial zoom
zoom = 7;
// Check if this is the first run
final SharedPreferences prefs = context.getSharedPreferences("slo.bankomati.core", Context.MODE_PRIVATE);
if(prefs.getBoolean("firstrun", true))
{
// Check if database exists and delete it
if(Database.exists(context))
{
Database.delete(context);
}
prefs.edit().putBoolean("firstrun", false);
}
// Fetch all atms
try {
db = new Database(context);
atms = db.getAtms();
db.close();
} catch (Exception e) {
// TODO: Temporary solution
}
// Create an empty array for filtered results
filtered = new ArrayList<Atm>();
markers = new HashMap<Marker, Atm>();
// Reference the resources and context
this.resources = context.getResources();
this.context = context;
// Register camera & info window listener with the map
map.setOnCameraChangeListener(this);
//map.setOnInfoWindowClickListener(new ShowDetails(context, resources));
map.setOnMarkerClickListener(new ShowDetails(context));
}
मैं सभी विचारों से बाहर हूँ मैं GooglePlay सेवा AVD पर चल नहीं मिल सकता है 2.2+ मैं AVD 4.4 Google Play एपीआई यह GPService आता है लेकिन ti अभ्यस्त नक्शा प्रदर्शित करने की कोशिश की। तो सीधे मेरे उप प्रश्नों को इंगित करने के लिए:
1) यदि सभी एवीडी 2.2 से 4.4 तक सभी Google Play सेवाओं के काम के बिना हैं तो हम एकाधिक फोन के बिना एकाधिक फोन और ओएस संस्करणों के लिए एप्लिकेशन का परीक्षण कैसे कर सकते हैं।
2) क्या पुराने डिवाइस पर GoogleMap को प्रदर्शित करने का कोई निश्चित तरीका या अधिक उचित तरीका है, मैं एंड्रॉइड 2.2+ से बात कर रहा हूं। मैंने अपने मानचित्र को प्रदर्शित करने का सबसे छोटा तरीका उपयोग किया है मेरे पास मेरे लेआउट xml में एक समर्थन मैप फ्रैगमेंट तत्व है। जिस समस्या का मैं अनुभव कर रहा हूं वह यह है कि कुछ 2.2 और 2.3 फ़ोन जिनके पास Google PlayStore है, वे एप्लिकेशन खोलने वाले एप्लिकेशन को खोलेंगे या नहीं खोलेंगे, जो मानचित्र को प्रदर्शित नहीं करते हैं, लेकिन वे नीचे मानचित्र ज़ूम नियंत्रण और Google लोगो प्रदर्शित करते हैं।
3) मैंने अपनी लेआउट फ़ाइल जोड़ा लेकिन मेरे पास अब मेरा एंड्रॉइड फोन नहीं है और एवीडी मुझे उस एप्लिकेशन का परीक्षण करने नहीं देता है जिसके लिए Google PlayServices की आवश्यकता है, यह संभव है कि मेरा लेआउट प्रदर्शित हो, ओवरले लेआउट के कारण समस्या पैदा कर रहा है।
मूल रूप से पृष्ठभूमि में एक फ्रेम लेआउट है जिसमें मेरे पास GoogleMap है और उसके शीर्ष पर शीर्ष कोने में मेरे पास एक स्पिनर और बटन है। जब मैंने आखिरी बार इस एप्लिकेशन का परीक्षण किया तो यह मेरे फोन एचटीसी वन वी एंड्रॉइड 4.0.3 पर काम करता था।
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/root_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<Button
android:id="@+id/gpsbttn"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/gps"
android:minHeight="28dip"
android:minWidth="28dip"
android:text="" />
<Spinner
android:id="@+id/bankslist"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:entries="@array/banks_list"
android:prompt="@string/banks_prompt" />
</FrameLayout>
सबसे आसान समाधान:
सभी दोस्तों जो पूरी तरह AVD के माध्यम से अपने आवेदन पत्र का परीक्षण करने में सक्षम नहीं होने के इस मुद्दे के पार चलो करने के लिए Genymotion एम्यूलेटर करने के लिए स्विच यह एक जीवन रक्षक है या नहीं। यह तेज़ है, यह कम छोटी गाड़ी है और यह एक वास्तविक फोन की हर सुविधा का समर्थन करता है और एंड्रॉइड ऐप्स के लिए 2.2 से इतना आसान बनाता है।
मैं जेनी गया और कभी पीछे नहीं देखा।
हैं सावधान भ्रमित गूगल Google Play सेवाओं के साथ Play स्टोर नहीं बनें। सभी दो वास्तव में हिस्सा नाम है; मुझे लगता है कि आप ज्यादातर अपने प्रश्न में Google Play सेवाएं का मतलब है। –
क्या आपको LogCat में कोई अपवाद मिलता है? मुझे संदेह है कि 'GooglePlayServicesUtil.isGooglePlayServices उपलब्ध (संदर्भ)' क्लास नॉटफाउंड अपवाद को फेंकता है क्योंकि डिवाइस में 'Google PlayServicesUtil' नामक कोई भी कक्षा उपलब्ध नहीं है। इस मामले में, आपको अपवाद पकड़ना चाहिए और 'झूठा' वापस करना चाहिए। – ADTC