Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 29    Views: 75

LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
01/02/15 06:20 AM (9 years ago)

Offline MapKit Android

Hey Smug, after my iOS version is complete, I am working on the Android Version. Got the location menu and everything else going, just having trouble with the offline map kit as my map is not showing at all. I can see all of my location pins and my location but just no map showing at all. I have to click away the loading screen as well, but that might be gone as soon as a map shows. It looks like the code is not looking for the map name I put in the control panel as it always just looks for gaia: 1-02 14:03:07.323: W/ZZ(14217): BT_fileManager:copyAssetToCache: gaia.sqlitedb 01-02 14:03:07.473: W/ZZ(14217): SW_offlineMapKit: copyAssetToCache: .sqlitedb 01-02 14:03:07.473: W/ZZ(14217): loading offline map from :/data/data/com.birdiebookandroid/files/gaia.sqlitedb 01-02 14:03:07.483: I/org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase(14217): sdcard state: mounted 01-02 14:03:07.483: W/ZZ(14217): loaded offline map from :/data/data/com.birdiebookandroid/files/gaia.sqlitedb 01-02 14:03:07.493: I/org.osmdroid.tileprovider.MapTileProviderBase(14217): rescale tile cache from 0 to 11 01-02 14:03:07.493: I/org.osmdroid.tileprovider.MapTileProviderBase(14217): Finished rescale in 3ms 01-02 14:03:07.493: D/skia(14217): GFXPNG PNG bitmap created width:48 height:48 bitmap id is 270 01-02 14:03:07.503: D/skia(14217): GFXPNG PNG bitmap created width:40 height:40 bitmap id is 271 Changed my map name to gaia, but that didn't do the trick either. Happy to hear any solutions. Regards Leon
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/03/15 05:11 AM (9 years ago)
I'll have an answer in a minute. Cheers! -- Smug
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/03/15 05:18 AM (9 years ago)
On or around line 105 in the 'SW_offlineMapKit.java' file it currently states: swolmk_mapDB = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "swolmk_db", "gaia") + ".sqlitedb"; change that to: swolmk_mapDB = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "mapName", "gaia") + ".sqlitedb"; I'll make the change and upload a version update soon. What we're doing is providing the full filename to the property 'swolmk_mapDB' by obtaining the user provided value from the key 'mapName', and if it is blank, we use our default 'gaia' and use the gaia.sqlitedb database, which is sparse at best. Let me know if that fixes your issue. What the problem turned out to be was a mistake on my part with respect to json key names. Originally it was 'swolmk_db', later to be changed to the much more cryptic 'mapName'. I probably forgot to update the package. Mea Culpa. Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
01/04/15 11:54 AM (9 years ago)
Hey Smug, thx for the quick response, unfortunately it didn't change anything. I can see the location pins and a stupid loading screen which will not go away unless I press the android build in back button. If I do so and click on the mimimize button, I can see the map! If I keep clicking the minimize button everything around my map (grey area) is visible as well which is not pretty at all. IOS Version only shows the map and not the grey parts if you know what I mean. Hope you find the solution. Regards Leon
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/04/15 06:10 PM (9 years ago)
Could you send me a link to the database you're using? It all kind of seems normal to me now. Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
01/04/15 11:43 PM (9 years ago)
same database as the iOS version. What sort of link to my database do you need? The data url is: http://appserver.appkingz.net/wb_addons/maps/map_locations.php?appGuid=EAF7B673BD1E4746945EEC690
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/05/15 12:23 AM (9 years ago)
the sqlite database you're trying to use in the app. Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
01/05/15 02:06 AM (9 years ago)
Here you go: http://www.appkingz.de/downloads/keks.zip Should be all fine as I followed your tutorial with Mobac and your basic gaia map has the same problem, so that I thought that can not be the problem!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/05/15 04:28 AM (9 years ago)
I think we have a zoom issue. I bet if you run the app, and select the screen, after 'pinching' a few times, it will show up. This is because it's zooming in around level 12/15 or so (this is the default) and your map doesn't go to that resolution. You should be able to set the default zoom in the control panel (Map Behavior). Change it to 8, refresh the config and you should see a world of difference. Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
01/05/15 05:06 AM (9 years ago)
Yes, correct, that shows the map indeed, thx. Still some bugs left. I solved the loading screen issue as I commented out the "showProgress(null, null);" in line 161. 5 problems left. problem 1: If I move around the map and zoom down to look or click on a pin and the move to the right or left the map "breaks" please see what I mean here: <a href="http://www.appkingz.de/downloads/android_map.png" target="_blank" rel="nofollow">http://www.appkingz.de/downloads/android_map.png</a> problem 2: user location is not shown. In the iOS version the map always shows the current user location and even hops back to the user location after pressing details on a location and coming back to the map screen again. Cant see that happening in the android version. problem 3: If I click around in the map, testing some location infos and pressing back to the map screen again, the app often kills itself with this error: 01-05 12:54:52.575: E/AndroidRuntime(2529): FATAL EXCEPTION: Thread-4978 01-05 12:54:52.575: E/AndroidRuntime(2529): Process: com.birdiebookandroid, PID: 2529 01-05 12:54:52.575: E/AndroidRuntime(2529): java.lang.OutOfMemoryError 01-05 12:54:52.575: E/AndroidRuntime(2529): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 01-05 12:54:52.575: E/AndroidRuntime(2529): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:683) 01-05 12:54:52.575: E/AndroidRuntime(2529): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:513) 01-05 12:54:52.575: E/AndroidRuntime(2529): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:889) 01-05 12:54:52.575: E/AndroidRuntime(2529): at android.content.res.Resources.loadDrawable(Resources.java:3426) 01-05 12:54:52.575: E/AndroidRuntime(2529): at android.content.res.Resources.getDrawable(Resources.java:1898) 01-05 12:54:52.575: E/AndroidRuntime(2529): at com.birdiebookandroid.BT_fileManager.getDrawableByName(BT_fileManager.java:263) 01-05 12:54:52.575: E/AndroidRuntime(2529): at com.birdiebookandroid.BT_viewUtilities$BackgroundImageThread.run(BT_viewUtilities.java:177) problem 4: pinCOlor is set in the database but all my pins are red on the map. The right pinColor is shown if I press on details (details tap), but that is not much worth as the pinColor should be seen on the map itself. problem 5: driving directions are not shown on the information tap. Can only choose from details and ok. No car icon like in the iOS version. Thought the map would be easier for Android, but turns out, that iOS is way better again :(
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/06/15 06:46 AM (9 years ago)
1) Still trying to duplicate the problem. 2) Fixed that. Will provide an update soon. 3) Out of memory? Not sure what I can do to fix that. I'll poke my nose around. 4) Fixed that. 5) Directions work. There won't be any icons. But I noticed in the above URL, the childItems don't have a 'callOutTapChoice' json key/value pair. If you want to display driving directions, your location ChildItems need to have a json key/value pair of "calloutTapChoice" : "drivingDirections" along with the rest of your json for that location. I'll email you something to test with soon. for now I'm going to bed. Cheers! -- Smug
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/07/15 03:02 AM (9 years ago)
OK Leon, here's the scoop. 1) I can't get the problem to duplicate. I suspect it has to do with your sqlite db size. I'll take another look and see if there is something I can do about it, but at the moment, I'm not entirely sure. That's not a good answer, but it's the only one I have right now. 2) Fixed that in update v1.6 3) I suspect this may be related to #1 as well. Android memory. This is another 'not sure if I can do anything about it' situations. I've tried to economize on as much as I could, but there are many things in this plugin I have no control over, as they are within the osmdroid jar file. I'll let you know, but don't get your hopes up. 4) Fixed this in update v1.6 5) These work, with no changes necessary. But you *must* have the calloutTapChoice JSON key/value pair in your location child item. 6) Might not matter to those who use loadScreenObject from a script, but if you have childItems in the control panel, they won't lose their configuration after an edit the way they used to. I also fixed/changed a couple of small details that shouldn't affect the user side any. Keep in mind that I've done my best to maintain 'similar' functionality between iOS and Android, but not everything can be done 'exactly' the same. Dialog boxes and other 'system' level functions aren't as easy to override in Android the way they are in iOS, so although I've tried, not everything will be identical. Give it a shot and let me know how it works out for you. Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
01/09/15 09:38 AM (9 years ago)
Hey Smug, tried to get the updated package working, but offlineMap has 2 errors Error 1: Think pretty easy as a } is missing on line 395 mapView.invalidate();} instead of mapView.invalidate(); Error 2: Line 364: handleMarkerClick(index); The method handleMarkerClick(int) is undefined for the type
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/09/15 05:50 PM (9 years ago)
oops! That's what I get for rushing things. I'll fix up the package. Thanks! Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
01/12/15 03:48 PM (9 years ago)
Hey Smug, did you find time to fix the package already? Cant wait to do further tests :-)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/12/15 04:49 PM (9 years ago)
I think so... I can't remember now. It's been over an hour ;) Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
01/12/15 05:01 PM (9 years ago)
Can't see an update on my self hosted yet? Going to bed now, will try tomorrow morning :-)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/12/15 06:04 PM (9 years ago)
I didn't increment the version, so it may not show up as an update. Bug fixes I increment. Syntax issues, especially just a line or two, may not get the same treatment. Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
02/18/15 03:12 PM (9 years ago)
Hey Smug, I downloaded the file again but there is no change. Still the same file without your bug fixes. Upload did not work? Help
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/18/15 06:36 PM (9 years ago)
Try deleting from your self hosted, and re-syncing the plugin with BT. If that doesn't work, I'll advance the version, but I think because I didn't increment 1.6 for that small edit, your system thinks it has the latest version. It goes by version number, and not timestamps on the file, I guess. Let me know; we'll get you setup eventually :) Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
02/19/15 03:05 AM (9 years ago)
hmm, stupid me, could have thought of that myself! thx, that obviously worked... Stille some memory and scaling issues with the map, it just can't handle different zoom levels if that zoom level is not "integrated". Must find a way to somehow not allow the map to zoom outside the levels the map has! Ideas welcome ;-)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/19/15 04:49 AM (9 years ago)
You're preaching to the choir... It's not a really big deal in iOS, but in Android, the methods are there. I follow the methods. The methods aren't effective. I'm still looking into it, and as soon as I have an answer, you'll have an answer too. Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
02/19/15 05:07 AM (9 years ago)
Thx Smug! Will post here as well as soon as I find out something myself.
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
02/19/15 05:34 PM (9 years ago)
Probably better to open up a new thread about the following, but kinda fits together: on Smugs Location Menu on Android: If you search for an entry it pops up, but if you press it, a different entry shows up. Silly Android bug? Let me know if I should open a different thread for this one Smug please.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/19/15 08:25 PM (9 years ago)
Hmm... I *don't* think it's an android bug, but it shouldn't do 'that'. The way the 'theory' works is, you have a 'list' of locations, let's say 30 of them. without any search, they're numbered 1-30 (actually 0-29, but lets not confuse ourselves). But when you do a search, and the search results bring you '6' locations, those are 'supposed' to be in a separate array, so that they're numbered 1-6, and not 'the original location' number. And your discovery sounds like the 'menu choice' is still linked to the original number, not the 'current' number in the new array. I probably goofed somewhere. Gimme an hour to a day and I'll take a look. Thanks for finding issues. I don't always 'like' it, but I want a superior product, and that means no mistakes :) Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
02/20/15 03:43 AM (9 years ago)
Yes, that is exactly the behaviour! Good thinking without looking Smug :-) sure you will fix this as well! Any reason why your plugins are not in the market anymore? Hope it is not because of me ;-)
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
02/26/15 03:22 PM (9 years ago)
Hey Smug, did you have any chance to search for the "search-problem" yet?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/26/15 03:34 PM (9 years ago)
Sorry Leon; I haven't finished yet. Sometimes it takes a bit to setup a test environment, and I've been swamped. I am getting to it later today. Please have a little patience with me and I apologize for not getting to it as fast as I would have liked. Cheers! -- Smug
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
02/26/15 03:47 PM (9 years ago)
all good, I will wait however long it takes you :-)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/26/15 04:18 PM (9 years ago)
I'm just kind of swamped right now... Usually I don't have this much work, so I'm riding it while I can, lol! But I will get to it a bit later, once I reach a milestone for a project... Cheers! -- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.