PDA

View Full Version : Android 3.0 beta build



Adela_Silvia
20.05.2016, 09:43
For those that want to test our 3.0 beta builds (updated beta build from 10th of June)
https://www.dropbox.com/sh/rcr4gyzjrw16dg1/AABoLJIe2Y5kOyx9RjNg66PGa?dl=0

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

Looking forward to your feedback!

matej_tripwolf
09.06.2016, 16:35
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:



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.

dandronic
09.06.2016, 17:24
The requestScreenshot code is still there - i.e DebugMapActivity.java:


@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).isContinuousScreens hotOn()) {
mapView.requestScreenshot();
}
}

How to use it:


private void testScreenshot() {
mapView.setDrawingCacheBackgroundColor(Color.TRANS PARENT);
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();
}
}
}

matej_tripwolf
09.06.2016, 17:38
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!

matej_tripwolf
10.06.2016, 14:16
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:

2544

Adela_Silvia
10.06.2016, 15:03
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/changelog/android/2.5.1#sec06

matej_tripwolf
10.06.2016, 15:23
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/changelog/android/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?

Adela_Silvia
13.06.2016, 08:50
Hi Matej,

Yes- you're right.

matej_tripwolf
14.06.2016, 09:53
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:


<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

In our app, we use:


<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!

Adela_Silvia
21.06.2016, 14:29
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/19966864/what-kind-of-android-application-will-require-android-permission-read-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

matej_tripwolf
21.06.2016, 16:42
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/19966864/what-kind-of-android-application-will-require-android-permission-read-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.

Makes sense now, you want to mute the turn by turn voice directions when a phone call is in progress. We're not using this feature of your SDK in our app at the moment.

You are right though, it's safe not to have this permission, I re-tested now and the crash that I experienced before doesn't happen again, it was most likely because of an incompatible version of the offline map I was using. Speaking of which, my colleague who is working on our server-side just sent you an e-mail with some questions about the map version and the cutting tool which should be used for the new maps. What is actually the correct map version to use with the 3.0 SDK?



WRITE_EXTERNAL_STORAGE
I'll check this with the devs

That's great to hear, thanks again for the help!

Adela_Silvia
22.06.2016, 08:48
Happy to hear I could be of help.

For the last questions related to map version I'll respond via email.