Results 1 to 10 of 12

Thread: Android 3.0 beta build

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399

    Android 3.0 beta build

    For those that want to test our 3.0 beta builds (updated beta build from 10th of June)
    https://www.dropbox.com/sh/rcr4gyzjr...RjNg66PGa?dl=0

    The changeLog, the new documentation and the OneBox search documentation:
    https://www.dropbox.com/sh/elrfs95ai...VEtEGC1Ta?dl=0

    Looking forward to your feedback!
    Last edited by Adela_Silvia; 10.06.2016 at 14:58.

  2. #2
    Neuer skobbler
    Join Date
    09.06.2016
    Posts
    6
    Hey guys,

    I just tried out the SDK and there used to be a method called getScreenshot on SKMapSurfaceView, which is missing now and there is no mention of this change in the migration guide.

    The workflow was to do something like this to get a Bitmap representation of the current map contents:

    Code:
                
               surfaceView.requestScreenshot();
               synchronized (surfaceView) {
                    surfaceView.requestRender();
                    try {
                        surfaceView.wait();
                        bitmap = surfaceView.getScreenshot();
                    } catch (final InterruptedException e) {
                        e.printStackTrace();
                    }
                }
    Any alternative to this? I need a Bitmap, not a file.

  3. #3
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    The requestScreenshot code is still there - i.e DebugMapActivity.java:

    Code:
    @Override
        public void onMapRegionChanged(SKCoordinateRegion skCoordinateRegion) {
            if (DebugSettings.currentSettings != null && DebugSettings.currentSettings instanceof MapStateDebugSettings) {
                ((MapStateDebugSettings) DebugSettings.currentSettings).update();
            }
    
            if (DebugSettings.currentSettings != null && DebugSettings.currentSettings instanceof ScreenshotDebugSettings &&
                    ((ScreenshotDebugSettings) DebugSettings.currentSettings).isContinuousScreenshotOn()) {
                        mapView.requestScreenshot();
            }
        }
    How to use it:

    Code:
     private void testScreenshot() {
            mapView.setDrawingCacheBackgroundColor(Color.TRANSPARENT);
            mapView.requestScreenshot();
            synchronized (mapView) {
                mapView.requestRender();
                try {
                    mapView.wait();
                    Bitmap mapBitmap = mapView.getScreenshot();
                    String filename = "/storage/sdcard0/captures/" + new SimpleDateFormat("hh:mm:ss").format(new Date()) + ".png";
                    FileOutputStream out = null;
                    try {
                        out = new FileOutputStream(filename);
                        mapBitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
                    } catch (Exception e) {
                        e.printStackTrace();
                    } finally {
                        try {
                            if (out != null) {
                                out.close();
                            }
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                } catch (final InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }

  4. #4
    Neuer skobbler
    Join Date
    09.06.2016
    Posts
    6
    Hey,

    thanks for the help, but I think you misunderstood me.

    The getScreenshot method used to return a Bitmap straight away. I need a Bitmap of the map contents, I don't need to write it to a file, I need to do something with this Bitmap, as it is, in memory.

    The getScreenshot method just doesn't exist anymore in the 3.0 beta of the SDK
    , that's what I was asking about. I wanted to know whether this was intentional or accidental, since it's not mentioned in the migration guide PDF.

    I know that I can use the renderMapBoundingBoxToFile method and then load the file into a Bitmap, but I would really like to avoid this overhead since I do some compositing in memory and then write the result to a file again.

    Thanks in advance!

  5. #5
    Neuer skobbler
    Join Date
    09.06.2016
    Posts
    6
    Also, I've noticed, the newly introduced method, animateToLocation, in SKMapSurfaceView, doesn't work as described in the documentation.

    The documentation says:

    Centers the map in the specified position smoothly.
    but instead, it positions the map viewport in such a way that this location is at the center bottom of the screen, like so:

    Screenshot_20160610-141119.jpg

  6. #6
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    The method "getScreenshot" was removed since 2.5.1 SDK and was added "onScreenshotReady"-please check the changelog for more details: http://developer.skobbler.ro/changel...id/2.5.1#sec06

  7. #7
    Neuer skobbler
    Join Date
    09.06.2016
    Posts
    6
    Quote Originally Posted by Adela_Silvia View Post
    The method "getScreenshot" was removed since 2.5.1 SDK and was added "onScreenshotReady"-please check the changelog for more details: http://developer.skobbler.ro/changel...id/2.5.1#sec06
    Great, thanks! So it was a change already in the 2.5.1 SDK. Sorry, didn't see that.

    Am I correct in assuming that the flow is to just call the requestScreenshot method, and await the Bitmap in the onScreenshotReady method?

  8. #8
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    Hi Matej,

    Yes- you're right.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •