(Android/iOS/Browser) Add: `TileOverlayOptions.getTile` can return  "base64 encoded image(png,gif,jpeg)".
MODIFY
README.md
README.md
});
```
+ - Add: (Android/iOS/Browser) `TileOverlayOptions.getTile` can return **base64 encoded image(png,gif,jpeg)**.
+
- **v2.4.6**
- Fix: (iOS) Only `src/ios/check_sdk_version.js` error.

MODIFY
src/android/plugin/google/maps/PluginTileProvider.java
src/android/plugin/google/maps/PluginTileProvider.java
@@ -147,7 +147,7 @@ public class PluginTileProvider implements TileProvider {
}
});
try {
- semaphore.wait(1000); // Maximum wait 1sec
+ semaphore.wait(10000); // Maximum wait 10sec
} catch (InterruptedException e) {
e.printStackTrace();
return null;
@@ -174,6 +174,15 @@ public class PluginTileProvider implements TileProvider {
}
}
+ if (urlStr.indexOf("data:image/") == 0 && urlStr.contains(";base64,")) {
+ String[] tmp = urlStr.split(",");
+ Bitmap image = PluginUtil.getBitmapFromBase64encodedImage(tmp[1]);
+ tile = new Tile(tileSize, tileSize, bitmapToByteArray(image));
+ image.recycle();
+ image = null;
+ return tile;
+ }
+
if (urlStr.startsWith("http://localhost") ||
urlStr.startsWith("http://127.0.0.1")) {
if (urlStr.contains("://")) {

MODIFY
src/ios/GoogleMaps/PluginTileProvider.m
src/ios/GoogleMaps/PluginTileProvider.m
@@ -91,7 +91,7 @@ NSDictionary *debugAttributes;
}];
- dispatch_semaphore_wait(self.semaphore, dispatch_time(DISPATCH_TIME_NOW, 10 * 1000 * 1000 * 1000)); // Maximum wait 10sec
+ dispatch_semaphore_wait(self.semaphore, dispatch_time(DISPATCH_TIME_NOW, (uint64_t)(10 * NSEC_PER_SEC))); // Maximum wait 10sec
}
NSString *urlStr = nil;
@@ -118,6 +118,20 @@ NSDictionary *debugAttributes;
return;
}
+ if ([urlStr rangeOfString:@"data:image/"].location != NSNotFound &&
+ [urlStr rangeOfString:@";base64,"].location != NSNotFound) {
+
+ NSArray *tmp = [urlStr componentsSeparatedByString:@","];
+
+ NSData *decodedData = [NSData dataFromBase64String:tmp[1]];
+ UIImage *image = [[UIImage alloc] initWithData:decodedData];
+ if (image.size.width != self.tileSize || image.size.height != self.tileSize) {
+ image = [image resize:self.tileSize height:self.tileSize];
+ }
+ [receiver receiveTileWithX:x y:y zoom:zoom image:image];
+ return;
+ }
+
NSRange range = [urlStr rangeOfString:@"http"];
if (range.location == 0) {
//-------------------------
@@ -208,6 +222,7 @@ NSDictionary *debugAttributes;
}
+
}
- (UIImage*)drawDebugInfoWithImage:(UIImage*)image x:(NSInteger)x y:(NSUInteger)y zoom:(NSUInteger)zoom url:(NSString *)url {

(Android/iOS/Browser) Add: `TileOverlayOptions.getTile` can return  "base64 encoded image(png,gif,jpeg)".