cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Map Extension does not recognize androidContext() in MDK application

Former Member
0 Likes
1,137

Hi guys,

currently I develop an MDK application in Visual Studio Code using your MDK extension for VSC.

I added the extension you created from: https://developers.sap.com/tutorials/cp-mobile-dev-kit-map-extension.html. Note, that I didn't change any code, its the same version posted in the tutorial.

For iOS, the map works as expected, but for Android, I recognized some issue. I checked for your documentation (https://help.sap.com/viewer/977416d43cd74bdc958289038749100e/3.2/en-US/9411d35cb91a4a8986a2635b7375c...) and analogue to it, the Map extension tries to create a new instance for the "_mapView" variable (object of class MapView):

this._mapView = new com.google.android.gms.maps.MapView(this.androidContext());

This line, however, throws a java.lang.NullPointerException, because the context of android (this.androidContext()) is null for me.

In the second link I posted above, the following information is delivered about the androidContext:
androidContext() - this function returns the current page's context that will be needed to create an Android native view.

Do you have any idea, why this problem occurs? Do I maybe have to adjust something, since, e.g., the mdk client sdk has been changed? In my TypeScript-file, the current android context is null and that is why I think, that the NullPointerException is thrown.

Thank you in advance for your help!

Best regards,

Sher-Chan Kodirov

View Entire Topic
Former Member
0 Likes

hi jitendrakumar.kansal,

for your info, I found the solution. After I exchanged the "this.androidContext()" with app.android.context in the code of your tutorial (for the map extension), I was finally able to display the correct result.

BR,

Sher-Chan Kodirov

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Likes
Sher-Chan KodirovThanks for heads-up. Glad you got it working.coming to original query, i see it working with source code mentioned in the tutorial and also debugging the "this.androidContext()" returns below.You can raise an OSS ticket for further investigation if something breaks as per tutorial.
Object {constructor: , _needRestart: false, _callbacks: ActivityCallbacksImplementation}
_callbacks:ActivityCallbacksImplementation {_rootView: Frame}
_needRestart:false
constructor:function () { … }
isNativeScriptActivity:true
skipExit:undefined
super:Object
__proto__:Activity {constructor: }