Google Maps doesn´t work on Galaxy s3 with 4.03 - android

I am working on an AVD with the specs of a Galaxy S6. There I can use the SupportMapFragment without problems.
But when a customer tries to use the App including the Map on a Galaxy S3 Device with 4.9" and Android Version 4.03, the App doesn't show the Map.
What can I do?
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="ibas.locatixteamviewer.MapsActivity">
<!--<Button-->
<!--android:id="#+id/button1"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:background="#359c5e"-->
<!--android:layout_alignParentTop="true"-->
<!--android:layout_alignParentEnd="true"-->
<!--android:padding="8dp"-->
<!--android:layout_margin="5dp"-->
<!--android:src="#drawable/menu_car_side_7_white"-->
<!--android:textColor="#ffffff" />-->
</fragment>
//----------------------------
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
Thanks!

Related

Bad magic number for Bundle: 0x6f0063 SupportMapFragment

I have this issue on Android 5.1.1 (OPPO phone)
Fatal Exception: java.lang.IllegalStateException: Bad magic number for Bundle: 0x6f0063
at android.os.BaseBundle.readFromParcelInner(BaseBundle.java:1346)
at android.os.BaseBundle.readFromParcelInner(BaseBundle.java:1334)
at android.os.Bundle.readFromParcel(Bundle.java:1046)
at com.google.android.gms.maps.internal.IMapFragmentDelegate$zza$zza.onResume(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zza.onResume(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onSaveInstanceState(Unknown Source:6000)
at android.support.v4.app.Fragment.performSaveInstanceState(Fragment.java:2353)
at android.support.v4.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManager.java:2599)
at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:2670)
at android.support.v4.app.FragmentController.saveAllState(FragmentController.java:134)
at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:571)
at android.support.v7.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:509)
It is hard to re-produce, but it almost occured on OPPO phone Android 5.1.1.
Maybe it related to this issue
https://issuetracker.google.com/issues/37011984
Any workarround to fix it? Thanks in advance.
This is a part of activity xml
<fragment
android:id="#+id/map"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
onCreate activity
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);

SupportMapFragment not showing Google Logo

I am using SupportMapFragment to display Google Maps in my app:
SupportMapFragment mMapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentByTag(MAP_FRAGMENT_TAG);
if (mMapFragment == null) {
mMapFragment = new SupportMapFragment();
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.add(R.id.map_frame, mMapFragment, MAP_FRAGMENT_TAG).commit();
}
mMapFragment.getMapAsync(this);
This is the xml part:
<FrameLayout
android:id="#+id/map_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/button_status_view">
</FrameLayout>
Unfortunately, the map doesn't show the Google logo which causes violation on the Google Maps APIs terms of service (https://developers.google.com/maps/terms) In particular clause 9.4(a), which does not allow developers to delete or alter the Google logo on the map displayed in your app.
How can I add the Google logo to the map? Should it be there by default? Am I missing something? The fragment currently shows only the GPS button.
use MapFragment instead of Frame Layout:
<fragment android:id="#+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.googlemapdemo.MapsActivity"/>

Is it possible to display google Map in android wear device using Google Maps Android API v2?

I would like to display google map in Android wear device using Google Maps Android API v2.
I can access to google play service and get the available status. However, I got NullPointerException error after the code mGoogleMap = fragment.getMap();
// Getting Google Play availability status
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());
if(status!=ConnectionResult.SUCCESS){ // Google Play Services are not available
....
}else { // Google Play Services are available
// Getting reference to the SupportMapFragment
SupportMapFragment fragment = ( SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
// Getting Google Map
mGoogleMap = fragment.getMap();}
My layout file is as follows:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MyActivity" >
<fragment
android:id="#+id/map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.google.android.gms.maps.SupportMapFragment" />

Android SupportFragment returns Map Object as null

I am displaying a map in my android application like this:
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
The fragment is defined like this:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
map:cameraTargetLat="28.635308"
map:cameraTargetLng="77.224960"
map:uiCompass="true"
map:uiRotateGestures="true"
map:uiScrollGestures="true"
map:uiTiltGestures="true"
map:uiZoomControls="true"
map:uiZoomGestures="true"/>
The problem is on some mobiles it is working fine while on others(android 2.2,2.3) it is not working. The map object is null in these cases.
To me it appears that the reason behind this is that google play services is not installed on these mobiles. Am i correct, if yes what is the possible workaround.

Google maps v2 on android devices with minSDK below 11

i have problem with this line when I create project which use Google maps API v2.
GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
It's says that I need to set minSDK to be minimum 11, but I want to use this application also on devices with android minSDK 8 (2.3.3). Any ideas? Or simply: How I can set google maps API v2 to be compatible with devices with minSDK 8.
Thanks
Use SupportMapFragment from a FragmentActivity, instead of MapFragment from an Activity. To use fragments on devices older than API Level 11, you need to use the Android Support package's backport of fragments (where FragmentActivity comes from).
http://android-er.blogspot.de/2012/12/using-supportmapfragment.html - small example
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/hello_world" />
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
AND:
package de.meinprospekt.android.ui;
import java.text.SimpleDateFormat;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Fragment fragment = getSupportFragmentManager().findFragmentById(
R.id.map);
SupportMapFragment mapFragment = (SupportMapFragment) fragment;
GoogleMap mMap = mapFragment.getMap();

Categories

Resources