Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Android 3.0 beta build

  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.

  9. #9
    Neuer skobbler
    Join Date
    09.06.2016
    Posts
    6
    A few questions regarding permissions:

    READ_PHONE_STATE

    This seems to cause the app to crash now if it's not granted, whereas in the 2.5.0 version of the SDK it did not. We would really, really like to avoid adding this permission because it's counter intuitive to the user and makes the app look dodgy when we have to ask for it in Marshmallow (40% of our user base). The description says "Read phone status and identity". It's hard to convey to the user why the map would need this kind of information without putting them off. We used to have it before for generating one of our internal identifiers but have since moved to some equally good, freely available components, specifically to make the user experience in Marshmallow better. Can you please explain why it's required for SKMaps?


    WRITE_EXTERNAL_STORAGE

    In the guide for integrating the SDK you list it just as:

    HTML Code:
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    In our app, we use:

    HTML Code:
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
    The android:maxSdkVersion="18" part means it will not be included in the Manifest when deployed to devices running KitKat or later. The only reason to include this in the manifest for those versions would be in order to write stuff to public directories on the storage (e.g. photo gallery), which is not what most apps/libraries need. If the library just needs to access the its own directories (mnt/sdcard/Android/data/com.yourpackagename/ or /data/data/com.yourpackagename/), this doesn't require the WRITE_EXTERNAL_STORAGE permission from KitKat onward, and most importantly, means we don't have to ask for this permission in Marshmallow. Can you check whether having android:maxSdkVersion="18" is acceptable for you?

    Thanks in advance!

  10. #10
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    READ_PHONE_STATE
    As far as I remember we have that requirement to have the ability to mute audio during phone calls.
    (see last answer here: http://stackoverflow.com/questions/1...ead-phone-stat )
    When READ_PHONE_STATE is not put in AndroidManifest.xml file we catch the exception in the SDK but show a log to know that this exception has occurred, but you don't have to worry about the error.


    WRITE_EXTERNAL_STORAGE
    I'll check this with the devs

Posting Permissions

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