To create a licence file you need :
- Package Name : The package name of the application you want to use SDK in.
- SH1 fingerprint : SH1 fingerprints from your required apk sign keys. (Release key, debug key, etc)
Add maven repository to your project level build.gradle
repositories {
//add maven repo here
maven { url "https://maven.neshan.org/artifactory/public-maven" }
}
Add to build.gradle
module app
dependencies {
//Neshan sdk library
implementation 'neshan-android-sdk:mobile-sdk:0.9.7'
}
<uses-permission android:name="android.permission.INTERNET"/>
Define main layout as res/layout/activity_main.xml, so that it contains org.neshan.ui.MapView
element:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<org.rajman.ui.MapView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/map"/>
</android.support.constraint.ConstraintLayout>
Java Code :
public class MainActivity extends AppCompatActivity {
private MapView map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map = findViewById(R.id.map);
//set map focus position
LngLat focalPoint = new LngLat(53.529929, 35.164676);
map.setFocalPointPosition(focalPoint, 0f);
map.setZoom(14f);
//add basemap layer
map.getLayers().add(NeshanServices.createBaseMap(NeshanMapStyle.STANDARD_DAY));
}
}
Kotlin Code :
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//set map focus position
map.setFocalPointPosition(LngLat(53.529929, 35.164676), 0f)
map.setZoom(14f)
//add basemap layer
map.layers.add(NeshanServices.createBaseMap(NeshanMapStyle.STANDARD_DAY))
}
}