Android Tutorial Google Maps

Status
Not open for further replies.

evbedp

Member
Licensed User
Longtime User
i can't found MapFragment in designer, that's why i'm initializing in my code.

I got a different error than the one you got. You need to add MagFragment with the designer instead of initializing it in your code:

 

ThePuiu

Active Member
Licensed User
Longtime User
I followed all the steps in the tutorial (hope!), but when compiling, I get the error message:
B4A version: 6.31
Parsing code. (0.00s)
Compiling code. (0.06s)
Compiling layouts code. (0.00s)
Organizing libraries. Error
Maven artifact not found: com.google.android.gms/play-services-maps

I attached a small test project to show the error. Attached is also the SDK Manager configuration.
Pls, can anyone tell me what's wrong?
 

Attachments

  • installed.jpg
    119.4 KB · Views: 508
  • test.zip
    8.2 KB · Views: 538

ThePuiu

Active Member
Licensed User
Longtime User
I tried to add this code to the manifest editor, but the result is the same:
Maven artifact not found: com.google.android.gms/play-services-maps

Pls help!

B4X:
'************ Firebase Base ************
CreateResourceFromFile("google-services", "google-services.json")
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
AddPermission(${applicationId}.permission.C2D_MESSAGE)
AddManifestText( <permission android:name="${applicationId}.permission.C2D_MESSAGE"
  android:protectionLevel="signature" />)
AddApplicationText(
<receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  android:exported="false"/>
   <provider
  android:authorities="${applicationId}.firebaseinitprovider"
  android:name="com.google.firebase.provider.FirebaseInitProvider"
  android:exported="false"
  android:initOrder="100" />
    <receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  android:exported="false"/>
   <receiver
  android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
  android:exported="true"
  android:permission="com.google.android.c2dm.permission.SEND" >
  <intent-filter>
  <action android:name="com.google.android.c2dm.intent.RECEIVE" />
  <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
  <category android:name="${applicationId}" />
  </intent-filter>
  </receiver>
    <receiver
  android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
  android:exported="false" />


  <service
  android:name="com.google.firebase.iid.FirebaseInstanceIdService"
  android:exported="true">
  <intent-filter android:priority="-500">
  <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
  </intent-filter>
  </service>
)
'************ Firebase Base (end) ************
 

ThePuiu

Active Member
Licensed User
Longtime User
I just want to put some markers on the map. I do not know for which of the above code lines is needed. Whether I put all the code from the "Always required when using Firebase:" section, or just left a part of it or deleted it from the manifest editor, the error message from the compilation was the same. If you think the problem comes from the manifest code, please make a copy / paste with the required piece of code. I think a functional example of the attached library was very good for us who are at the beginning of the road ...
I hope not bother you too much!
 

ThePuiu

Active Member
Licensed User
Longtime User
Sorry, but I do not see any difference from the code posted. Instead, I discovered a possible problem: i don't have that path on my computer:
<android sdk>\extras\google\google_play_services\libproject\google-play-services_lib\res
There are only 2 subfolders in my google_play_services folder: docs and samples and there is no \ libproject \ google-play-services_lib \ res folder...
it is normal?
If I comment the line #AdditionalJar: com.google.android.gmslay-services-maps I'm not getting an error anymore, obviously the map does not work
 

ThePuiu

Active Member
Licensed User
Longtime User
The problem was generated by an incorrect path to the android.jar file! Now it's ok. I want to draw a line between the current position and a marker on the map. Line must move with the movement of the current position. How can this be done without leaving the previous lines on the map?
Thank you for your patience Manfred!

later edit:
Another problem for me is that I want the application to work in background with the tablet paused. When I get close to a marker to alert me. I have initialized the GPS in Starter but the application does not work in background. The GPS remains active (I think), but the sound signal is only received after the tablet comes out of the pause. Can I do what I want?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Image the situation. You get a new locationevent. Inside the event you get the actual position (before you change it) of the marker.
You now can draw a polyline from the old location to the new location. You then change the markers location to the new one to let the marker "move"...
But with creating a new polyline in each locationevent you can draw a line for the hole trip.

That`s all theory but it should work like this i guess. I never needed it.

BUT: You should create a NEW thread in the Questions forum for any new question you have.
 

shb777

Active Member
Licensed User
Longtime User
why can't you get it to work. and zip it up, so we can download it, and it will work right away?
 

javiers

Active Member
Licensed User
Longtime User
Error...


*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
android.content.res.Resources$NotFoundException: Unable to find resource ID #0x2711
at android.content.res.Resources.getResourceName(Resources.java:2363)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:891)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1072)
at android.app.BackStackRecord.run(BackStackRecord.java:852)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:452)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5637)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…