Android Tutorial OSMDroid - MapView for B4A tutorial

warwound

Expert
Licensed User
Fact.

I am working in Windows 7. Is there any problem if I upgrade to Windows 10?

Again, thank you.

Hmm..
Is this question related to the OSMDroid library?

b4a should work the same regardless of the version of Windows you use.
Though with older versions of Windows it might be necessary to update your .NET library so that the b4a IDE works properly.
 

Emerito

Member
Licensed User
I'm working on Windows 7 without any problem.
Now offer me the update to Windows 10 and I would, if I upgrade, trouble with B4A, when I'm in the middle of a job!.
As I use the Microsoft translator, not be if I explain clearly enough.
A greeting
 

warwound

Expert
Licensed User
Well in theory there should be no problem if you upgrade from Windows 7 to Windows 10.
But if you are in the middle of a job i'd certainly complete the current job and then upgrade.
 

Emerito

Member
Licensed User
Hi Martin

After clicking on a button (ic_...) ImageButtonsView, I can not return to click on it.
It is disabled. Not resolved it.
 

warwound

Expert
Licensed User
Hi.

I'm not sure what to suggest.
Without seeing your code it's impossible to help.

Can you post a b4a project that shows the problem - i'll compile it and try to debug the issue.

Martin.
 

Jean Pierre MALOBERTI

Member
Licensed User
Hi all

I'm testing B4A and OSMDroid and I'm impressed by your work guys !
Unfortunately, I'm trying to run some code from version 3.08 in version 4.1 with the same data (a simple ZIP from jpg tiles).

The 308 code was :
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("fond")
   
    ts.Initialize("extrait2", 12, 14, 500, ".jpg", "http://localhost/")
    ts.TMSMode = False
    Carto.Initialize("")
    Carto.SetDataConnectionEnabled(False)
    Carto.AddXYTileSource(ts)
    Carto.SetTileSource("extrait2")
    Carto.SetZoomEnabled(True)
    Carto.SetMultiTouchEnabled(True)
    If FirstTime Then
        Starter.MapCenter.Initialize(-21.005,55.280)
        Starter.ZoomLevel=12
        CompassEnabled = MaPosition.CompassEnabled
        FollowLocationEnabled = MaPosition.FollowLocationEnabled
        MyLocationEnabled = MaPosition.MyLocationEnabled
    Else
        MaPosition.CompassEnabled = CompassEnabled
        MaPosition.FollowLocationEnabled = FollowLocationEnabled
        MaPosition.MyLocationEnabled = MyLocationEnabled
    End If
    Carto.Zoom = Starter.ZoomLevel
       Carto.SetCenter3(Starter.MapCenter)

    PanCarte.AddView(Carto, 0, 0, 100%x, 100%y)
End Sub
All is ok.

The 4.1 code is :
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("fond")
   
    Carto.Initialize("")
    Carto.SetUseDataConnection(True)
   
    Dim tsName As String = "extrait2"
    Dim TileSourceFactory1 As OSMDroid_TileSourceFactory
   
    If Not(TileSourceFactory1.ContainsTileSource(tsName)) Then
        Dim MyTileSource As OSMDroid_UrlTileSource
        MyTileSource.Initialize(Carto, tsName, "http://localhost/%3$d/%1$d/%2$d.jpg", 12, 14, 500)
        TileSourceFactory1.AddTileSource(MyTileSource)
    End If
    Carto.SetTileSource(TileSourceFactory1.GetTileSource("extrait2"))
   
    Carto.SetBuiltInZoomControls(True)
    Carto.SetMultiTouchControls(True)
    If FirstTime Then
        Starter.MapCenter.Initialize(-21.005,55.280)
        Starter.ZoomLevel=17
    End If
    Carto.GetController.SetZoom(Starter.ZoomLevel)
       Carto.GetController.SetCenter(Starter.MapCenter)

    PanCarte.AddView(Carto, 0, 0, 100%x, 100%y)
End Sub
The tiles are no more displayed. What's wrong ?
The mImageFilenameEnding attribute is not initialized. Is it a problem ?

Thanks
 

PCowling

Member
Licensed User
Hi

I have been having a play with the examples here, about half way through the day the map tiles stopped showing on the emulator. I have not changed any code. I thought there was an unlimited tile call for OSM?

I have downloaded and tried fresh projects, emulators and tried different tile sources, so think I have eliminated all the possible options.

Any help or advice would be great thanks.
 

warwound

Expert
Licensed User
The free to use tileservers have a habit of suddenly failing to serve any tiles.
They are generally funded by donations, and have limited resources.
They can become overloaded at any time and then simply fail to respond to requests for tiles.

The solution is to find another tileserver, one that is not so overloaded - that's unlikely to happen as other free tileservers will probably be overloaded too.

You could try the offline map example and use MOBAC to render your own offline tile archive:
http://www.b4x.com/android/forum/threads/mobac-supports-mapsforge-for-offline-tiles.53277/
 

Emerito

Member
Licensed User
Hi Martin,

The application I am doing uses the OSMDROID library. Make Tracks and set Waypoints.
They could tell me:
That kind of license do I need.
How to apply for it.
Thank you.
 

warwound

Expert
Licensed User
@Emerito

You want to handle the licenses for both: OSMDroid java library and the map tiles you use in your app.

OSMDroid java library is licensed under the Apache License 2.0.
See 'Code license' on the above link, left hand of page.

The license for the tiles you use in your app depends entirely upon which tileserver you use.
The default tileservers used by OSMDroid (Open Street Map based tileservers) license their tiles under the Creative Commons 3.0 BY-SA license.
See 'Content license' on the above lin, just under 'Code license'.
 

Emerito

Member
Licensed User
Excuse my stupidity. I'm having trouble interpreting the translation.
I understand that you attaching the downloaded document in
http://www.apache.org/licenses/LICENSE-2.0 ( TXT or HTML )
adding my data, is it enough? i.e., the license is granted?
In any case. Which would be the B4A tool to show the license?
You beg once more that I apologise.
Thanks

Could I send you the apk to see it?
 

warwound

Expert
Licensed User
@Emerito

I'd suggest you add a new Activity to your project - an 'About' or 'Credits' Activity.
In the new Activity add a WebView and use the WebView to display something like:

This application uses the OSMDroid library which is licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a> license.<br>
<br>
OSMDroid displays map tiles which are licensed under the <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons 3.0 BY-SA</a> license.
 
Top