 Android- Augmented Reality
 


  (Augmented Reality)   -  ,           Pokemon GO,  ,   AR   .         ,     Android Studio    ,  Unity.





 Android- Augmented Reality



 



 ,2020



ISBN978-5-4483-8090-7

     Ridero







  admin@tmsoftstudio.com (mailto:admin@tmsoftstudio.com)



  (Augmented Reality)  -  ,         Pokemon GO,  ,   AR   .   Pokemon GO,    Google Tango Microsoft HoloLens    AR.

     ,  - -.    ,     .

,     3D Android   .  ,      ,      .

  (AR)       (   (VR),      ).   ,     ,       . ,          ,          .  ,  AR     :    .

     ,   2-D   ,  3-D   ,    , SLAM (Simultaneous Localization and Mapping),   ( GPS, , , ). ,    ,       Points ofInterest (POIs).

Ѡ ,      3-D ,   .  ,        (, , , ),       (,   ).

   , AR    ,    ,  , - -   .  ,   ,    3D-. Ѡ  ,     ,       3D-   .    ,       ,   ,  3D-  .

 ,  Pokemon GO,   -.        , Pokemon GO   3D-  .   , Pokemon GO     ,     AR.  ,      ,     ,       ,  ,     .              .

 Google Tango         ,   Tango      . Tango    ,   ,           . Tango     ,       .

     , AR     ࠖ     . AR ,  ,  GPS, ,                  -   GPS . AR ,   ,                 ,         .

      ,   Android Studio   ,  Unity.      SDK   AR ,    :

Vuforia   Qualcomm.  SDK       ,   ,  Android  IOS  Unity. Vuforia    , Smart Terrain (  ),     .

FastCV Computer Vision SDK   Qualcomm.   , ,    ,   ,  .  FastCV         ,               .

OpenCV (Open Source Computer Vision Library)        . OpenCV       .

ARToolKit   ,    ,    Natural Feature Tracking,   ,     , ,    ,   Unity3D OpenSceneGraph.

OpenSpace3D          .  OpenSpace3D  ,   3D-        ,  . OpenSpace3D        AR-.  ,      ,  Aruco  ,        ,      .

BeyondAR        ,    . Ѡ      2D-,     .

Beyond Reality Face Nxt    ,   ,   ,  Actionscript  HTML5/Javascript.

VISION SDK  ,      ,    AR    Apple  Android      . ѠVISION SDK         ,          .

ARLab ,   SDK, ARLab   3D-,       AR-. ARLab  ,       ,       . ARLab   ,    .

Wikitude SDK ,     ,  3D ,  , AR,  ,  ,  Android, iOS, Smartphone, Tablet, Smart Glasses, Cordova/PhoneGap, Titanium, Xamarin.

Intel RealSense SDK     User Facing (SR300) and World Facing (R200),   , , 3D   ,  ,  ,   (   ),           ,      3D .




Vuforia


  Unity  AR ,   ,    Unity.  ,  Unity   ,   ,    3D.  Unity.

 Vuforia Unity Extension    *.unitypackage.   Unity,   .  Vuforia Unity Extension .








  Main Camera    ARCamera  Assets/Vuforia/Prefabs  Project.

  Inspector   ARCamera.

      Vuforia    App LisenseKey.








    Position 0, 0, 0, Rotation 90, 0,0.

 Vuforia    ,    3D-.      Add Database  Develop/Target Manager.

  -    Add Target    .

Ѡ  Download Database       Unity .   Unity .








 3D ,    .   Unity   Window/Asset Store  Unity  3D .    Unity .

 Assets/Vuforia/Prefabs  Project    Image Target  Position 0, -10, 0, Rotation 0, 0,0.

  Image Target  Inspector  Image Target Behaviour  Database        .








  3D ,  Asset Store,  Position 0, 0, 0, Rotation 0, 0, 0.   Scale        .   Hierarchy    ImageTarget        Image Target.








,   Image Target     ,     Image Target    .

     ARCamera.    ARCamera  Inspector  Dataset Load Behaviour  Load markers Database Activate.








 Unity     Android .    File  Build Settings,   Android  Add Open Scenes   .








 Player Settings     .








  Company Name   ,  Other Settings  Bundle Identifier   ,   Company Name Product Name.








  Build  APK .

 APK   .        ,    3D .









ARToolKit



ARToolKit    ,     ,      .




ARToolKit   Unity


ARToolKit   Unity    https://artoolkit.org/download-artoolkit-sdk#unity.

      Unity   GitHub https://github.com/artoolkit/arunity5.

    Unity   3D .

  Assets  Import Package/Custom Package,    .








  Unity       Create/Create Empty   GameObject,   ARToolKit.

     AR   ARController ARMarker.     Scripts  ARToolKit.








ARController   -   AR .

ARMarker    ,   3D .   Marker tag   .








   Square,     Resources/ardata/markers.








   ,     ARUnity-tools\doc\patterns    Additional Unity Tools,     https://artoolkit.org/download-artoolkit-sdk.

    Square Barcode. Square Barcode  ,  ,     ARToolKit,     .            .

   Square Barcode   ARUnity-tools\doc\patterns    Additional Unity Tools.

   Square Barcode  ARController   Square tracking options  Pattern detection mode  AR_MATRIX_CODE_DETECTION,  Matrix Code Type    .








  ARMarker   Type  Square Barcode,  Barcode ID    .

    Multimarker,    Square Barcode    3D .    Multimarker   ARUnity-tools\doc\patterns    Additional Unity Tools.   Multimarker    ,     ,     ,      ,    .

   Multimarker  ARController   Square tracking options  Pattern detection mode  AR_MATRIX_CODE_DETECTION,  ARMarker   Type  Multimarker,  Multimarker config.      StreamingAssets.








    NFT .  Natural Feature Tracking (NFT)     ,    .

   NFT    ARUnity-tools\doc\Marker images    Additional Unity Tools.

  NFT   ARMarker   Type  NFT,  NFT dataset name      StreamingAssets.








 ,     ,    Example Scenes.

  ,    3D .

    jpeg  ,    NFT .

   bin     Additional Unity Tools,    genTexData. exe  NFT  

   :

genTexData. exe image.jpeg

          ,    ,           .

   NFT     . iset,.fset . fset3,    StreamingAssets Unity .

  ARMarker   Type  NFT,  NFT dataset name    NFT   StreamingAssets.

      Create/Create Empty   GameObject,   Scene root.   Scripts  Scene root  AROrigin,   ARToolkit     .

   Scene root  Inspector  Layer  9 .


















   ARController   Video Options  Layer    8 ,    Allow non-RGB video.








Ѡ  Create/Create Empty Child   GameObject,    Scene root,   Marker.   Scripts  Marker  ARTrackedObject,  .        .

   ARTrackedObject  Marker tag   ,   Marker tag   ARMarker.








ʠ Marker    3D .








     Scene root     Camera.








  Scripts  Camera  ARCamera,  Unity  AR .

   Camera  Culling Mask  9 .








         3D .

  Android   File  Build Settings,  Add Open Scenes   ,   Android   Player Settings.

  Company Name   ,  Product Name   ,  Other Settings  Bundle Identifier  com. [Company Name]. [Product Name].       .

  Plugins/Android    AndroidManifest. xml  package  com. [Company Name]. [Product Name].    Build  APK  Android .




ARToolKit  Android


 :

Java Development Kit1.7+

Android Studio IDE 1.5.x+

AndroidSDK

Git

  Git  Adjusting your PATH environment  Use Git from Git Bash only,  Configuring the line ending conversions  Checkout Windows-style, commit Unix-style line ends.

  Android NDK  Android Studio  File  Project Structure.

  Download AndroidNDK.








   Android SDK    ndk-bundle,  AndroidNDK.

  .

ANDROID_HOME = \android-sdks

ANDROID_NDK_ROOT = %ANDROID_HOME%\ndk-bundle

NDK = %ANDROID_HOME%\ndk-bundle

;%NDK%\  Path

GitHub   artoolkit5  artoolkit5\android  Git  build.sh  build_native_examples.sh.

,      $WinsVerNum     $WinsVerNum = 6.3.

else #Checking for Windows inanon-cygwin dependentway.

WinsOS=

if [[$OS]];then

WinsVerNum=$ {OS##*-}

echo $WinsVerNum

if [[$WinsVerNum = 10.0 || $WinsVerNum = 6.3]];then

if [[$WinsVerNum = 10.0]];then

WinsOS=Wins10

else

WinsOS=Wins8.1

fi

echo Building on Microsoft $ {WinsOS} Desktop \ ($ {ARCH}\)

export HOST_OS=windows

NDK_BUILD_SCRIPT_FILE_EXT=".cmd

CPUS=`/usr/bin/nproc`

fi

fi

fi



if [[! $CPUS]];then



echo **Development platform not supported, exiting script**

read -rsp $Press enter tocontinue\n

exit1

     libs  libARWrapper.so  libc++_shared.so   CPU   artoolkit5\android,    artoolkit5\AndroidStudioProjects.

 Android Studio   ARSimpleProj  AndroidStudioProjects.

  File  Project Structure ,   RSimple    RBaseLib,   ARBaseLibProj.    ,      File/Project Structure.

 ARBaseLib  Java  ARToolKit, ARActivity ARRenderer   ARToolKit    JNI   C++  ARWrapper,   libARWrapper.so  libc++_shared.so,     ARToolkit ,  ,   .

   ARToolKit ,  src\main     libs  libARWrapper.so  libc++_shared.so   CPU ,     RBaseLib   File/Project Structure/Add anew module/Import. JAR/.AAR Package/AndroidStuiodProjects/ARBaseLibProj/arBaseLib/build/outputs/aar/ ARBaseLib.aar.

 API  ARBaseLib   AndroidStudioProjects\ARBaseLibProj\doc.

   ARSimple,     ,   3D 򠖠.

  ARToolKit   Unity   gibraltar.jpg  genTexData. exe    .

genTexData. exe gibraltar.jpg

 . iset,.fset . fset3  AndroidStudioProjects\ARSimpleProj\aRSimple\src\main\assets\Data.

  SimpleRenderer    .

@Override

public boolean configureARScene (){



markerID = ARToolKit.getInstance().addMarker (nft; Data/gibraltar);

if (markerID <0) return false;



return true;

}

   build.gradle   versionCode   .

      ,   3D 򠖠.

,      camera_para. dat  src\main\assets\Data  ARToolKit .              .




OpenSpace3D


 OpenSpace3D,   Scol 3D       3D- SO3Engine,            .

 OpenSpace3D          .

 OpenSpace3D     , ,   Face Tracking.

  OpenSpace3D,    (http://www.openspace3d.com/lang/en/support/download/).       OpenSpace3D  C:\Users\user\Documents\OpenSpace3D.

    OpenSpace3D,  OpenSpace3D .








   ,  Preferences    .

      tutorial01_quickstart. xos  OpenSpace3D\demos\tutorial   Open scene    Import scene.













      cardboard     .








 Set physic.








,      Body type shape   0.1.

  cave ,      Set physic.













,      Body type collisionTree.

     Scene  Set physic setting.








,      ,       -9.8.    ,    .

         Scene ,    FPS Like Controller,     .








FPS like Controller PlugIT  ,         Scene  navigation/FPS like controller.     Delete .








    FPS like controller,    ,    ,   .








  Play/Stop  ,     .

 3D    ,   3D ,    .

        .             .








Remove  . Clone  ,      ,   . Set orientation   .

   ,   Move     .

 Rotate     ,  Scale     .

   ,    Set physic,    shape   ,    cave      collisionTree.    Freezed,      ,    .

   ,  Scene      Add dummy,        dummy.








     .

 PlugIT    .   ,  PlugIT    .








     Scene  PlugIT FPS like Controller   Delete .

        object/object click.   switch  PlugIT.   Object name   PlugIT  switch  .   Enable hand cursor.   Bubble label  click tolight Ok.








        object/light,   PlugIT   Omnidir.








     switch  LeftClick,    light_room, Off.








   ,       ,   .

Ѡ  Delete    .

        misc/sequence.








     switch  LeftClick,    On/Off sequence,  Input.      On/Off  Out1,    light_room,  Off.      On/Off  Out2,    light_room, On.








   ,       ,    .

      .            material/material color.     lamp.   .








     On/Off  Out1,    material color,  Enable.      On/Off  Out2,    material color,  Disable.








   ,       ,    ,    .

 ,     .           media/Video.   Apply on texture     oldscreen.   Url  .   Auto play Play inloop,  Volume  0,   Transparency.








    .

  lense  Zoom on selected object  .








     Add dynamic reflection map.   Lense,  reflection  512,   Enable.

     Add dynamic reflection map.   Lense,  refraction  512,   Enable Revert clip plane.     .








  .     Import scene/Standard file formats/OpenSpace3D\demos\tutorial\andy.scene/As anew group/Do you want toimport this environment setting/No.








     walk_inplace   Enable.

          object/object click.     andy_robot.








     pose_init   Enable.

          object/animation transition. First animation name  posed_init, Second animation name  posed2.








    wake up  LeftClick  animation transition,  Fadein.








,   ,   ,   .

        object/animation transition. First animation name  posed2, Second animation name  idle1.








    animation transition  Transition ended  animation transition1,  Fadein.








     idle  Edit setting.   Loop.

 ,   .

   .

  ,    OpenSpace3D\assets\models\library\Primitive_World\Edaphosaurus\Edafossauro.mesh.

     default_skl,  Edit setting   Loop.








     Scene  Add dummy.

   dummy.

        input/AR capture.








     Scene  Add camera.

  Move     Z.








        object/set active camera.      AR_camera.   Enable on init.








        input/AR marker.   Bitmap path   ,    OpenSpace3D .       .       dummy.








        oblect/hide.     dummy   Hide on start.








     AR marker  Found,    hide  Show.








     AR marker  Lost,    hide  Hide.

        input/keyboard.  .








     keyboard  Key down,    AR marker,  Register current frame.

    ,    蠖        3D .

   AR marker,      ,    .








        input/AR face tracker.       dummy.








     AR face tracker  Found,    hide  Show.      AR face tracker  Lost,    hide  Hide.








,    ,  3D .

  Android .    Export toOpenspace3D player  As an Android Application.








       Android   APK  bin.




BeyondAR


BeyondAR  ,       ,    .

    BeyondAR  Github https://github.com/BeyondAR/beyondar.

  BeyondAR_Examples   Android Studio.

    Android     .

  APK     , Gradle  :

defaultConfig{



multiDexEnabledtrue

}

dependencies{



compile 'com.android.support: multidex:1.0.0

}

android{



dexOptions{

javaMaxHeapSize4g

}

}

  :

<application



android:name="android.support.multidex.MultiDexApplication>

  , ,   OnMapReadyCallback.

package com.beyondar. example;



import android.content.Context;

import android. location. LocationManager;

import android. os.Bundle;

import android.support.v4.app.FragmentActivity;

import android.view.View;

import android.view.View. OnClickListener;

import android. widget. Button;

import android.widget.Toast;



import com.beyondar.android.plugin. googlemap. GoogleMapWorldPlugin;

import com.beyondar.android.util.location.BeyondarLocationManager;

import com.beyondar.android.world.GeoObject;

import com.beyondar.android. world. World;

import com.google.android.gms.maps.CameraUpdateFactory;

import com.google.android.gms.maps. GoogleMap;

import com.google.android.gms.maps. GoogleMap. OnMarkerClickListener;

import com.google.android.gms.maps. OnMapReadyCallback;

import com.google.android.gms.maps.SupportMapFragment;

import com.google.android.gms.maps.model.LatLng;

import com.google.android.gms.maps.model.Marker;



public class BeyondarLocationManagerMapActivity extends FragmentActivity implements OnMarkerClickListener, OnClickListener, OnMapReadyCallback{



private GoogleMap mMap;

private GoogleMapWorldPlugin mGoogleMapPlugin;

private World mWorld;



@Override

protected void onCreate (Bundle savedInstanceState){

super. onCreate (savedInstanceState);

setContentView(R.layout.map_google);



Button myLocationButton = (Button) findViewById(R.id.myLocationButton);



myLocationButton.setVisibility(View.VISIBLE);

myLocationButton.setOnClickListener (this);



((SupportMapFragment) getSupportFragmentManager () .findFragmentById(R.id.map)).getMapAsync (this);

}



@Override

public boolean onMarkerClick (Marker marker){

// Toget the GeoObject that owns the marker we use the following

// method:

GeoObject geoObject = mGoogleMapPlugin.getGeoObjectOwner (marker);

if (geoObject!= null){

Toast.makeText (this, Click on amarker owned byaGeoOject with the name: " +geoObject.getName(),

Toast.LENGTH_SHORT).show();

}

return false;

}



@Override

protected void onResume (){

super. onResume();

// When the activity is resumed it is time toenablethe

// BeyondarLocationManager

BeyondarLocationManager. enable();

}



@Override

protected void onPause (){

super. onPause();

// Toavoid unnecessary battery usage disable BeyondarLocationManager

// when the activity goes on pause.

BeyondarLocationManager. disable();

}



@Override

public void onClick (View v){

// When the user clicks on the button we animate the map totheuser

// location

LatLng userLocation = new LatLng(mWorld.getLatitude (), mWorld.getLongitude());

mMap.moveCamera(CameraUpdateFactory.newLatLngZoom (userLocation, 15));

mMap.animateCamera (CameraUpdateFactory. zoomTo (19), 2000, null);

}



@Override

public void onMapReady (GoogleMap googleMap){

mMap=googleMap;

// We create the world and fill the world

mWorld = CustomWorldHelper.generateObjects (this);



// As we want touse GoogleMaps, we are going tocreate the pluginand

// attach it tothe World

mGoogleMapPlugin = new GoogleMapWorldPlugin (this);

// Then we need toset the map intothe GoogleMapPlugin

mGoogleMapPlugin.setGoogleMap (mMap);

// Now that we have the plugin created lets add it toour world.

// NOTE: It is better toload the plugins before start adding objectin

// tothe world.

mWorld.addPlugin (mGoogleMapPlugin);

mMap.setOnMarkerClickListener (this);



mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mGoogleMapPlugin.getLatLng (), 15));

mMap.animateCamera (CameraUpdateFactory. zoomTo (19), 2000, null);



// Lets add the user position tothemap

GeoObject user = new GeoObject (1000l);

user.setGeoPosition(mWorld.getLatitude (), mWorld.getLongitude());

user.setImageResource (R. drawable. flag);

user.setName (User position);

mWorld.addBeyondarObject (user);



BeyondarLocationManager.addWorldLocationUpdate (mWorld);

BeyondarLocationManager.addGeoObjectLocationUpdate (user);



// We need toset the LocationManager tothe BeyondarLocationManager.

BeyondarLocationManager

.setLocationManager ((LocationManager) getSystemService (Context. LOCATION_SERVICE));

}

}

package com.beyondar. example;



import android. os.Bundle;

import android.support.v4.app.FragmentActivity;

import android.widget.Toast;



import com.beyondar.android.plugin. googlemap. GoogleMapWorldPlugin;

import com.beyondar.android.world.GeoObject;

import com.beyondar.android. world. World;

import com.google.android.gms.maps.CameraUpdateFactory;

import com.google.android.gms.maps. GoogleMap;

import com.google.android.gms.maps. GoogleMap. OnMarkerClickListener;

import com.google.android.gms.maps. OnMapReadyCallback;

import com.google.android.gms.maps.SupportMapFragment;

import com.google.android.gms.maps.model.Marker;



public class GoogleMapActivity extends FragmentActivity implements OnMarkerClickListener, OnMapReadyCallback{



private GoogleMap mMap;

private GoogleMapWorldPlugin mGoogleMapPlugin;

private World mWorld;



@Override

protected void onCreate (Bundle savedInstanceState){

super. onCreate (savedInstanceState);

setContentView(R.layout.map_google);



((SupportMapFragment) getSupportFragmentManager () .findFragmentById(R.id.map)).getMapAsync (this);



}



@Override

public boolean onMarkerClick (Marker marker){

// Toget the GeoObject that owns the marker we use the following

// method:

GeoObject geoObject = mGoogleMapPlugin.getGeoObjectOwner (marker);

if (geoObject!= null){

Toast.makeText (this, Click on amarker owned byaGeoOject with the name: " +geoObject.getName(),

Toast.LENGTH_SHORT).show();

}

return false;

}



@Override

public void onMapReady (GoogleMap googleMap){

mMap=googleMap;

// We create the world and fill the world

mWorld = CustomWorldHelper.generateObjects (this);



// As we want touse GoogleMaps, we are going tocreate the pluginand

// attach it tothe World

mGoogleMapPlugin = new GoogleMapWorldPlugin (this);

// Then we need toset the map intothe GoogleMapPlugin

mGoogleMapPlugin.setGoogleMap (mMap);

// Now that we have the plugin created lets add it toour world.

// NOTE: It is better toload the plugins before start adding object intothe world.

mWorld.addPlugin (mGoogleMapPlugin);



mMap.setOnMarkerClickListener (this);



mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mGoogleMapPlugin.getLatLng (), 15));

mMap.animateCamera (CameraUpdateFactory. zoomTo (19), 2000, null);



// Lets add the user position

GeoObject user = new GeoObject (1000l);

user.setGeoPosition(mWorld.getLatitude (), mWorld.getLongitude());

user.setImageResource (R. drawable. flag);

user.setName (User position);

mWorld.addBeyondarObject (user);

}

}

   Android    .








Simple AR camera     .       .

Simple camera with amax/min distance far for rendering         .

BeyondAR World inGoogle maps    .

AR camera with Google maps        .

Camera with touch events     ,      .

Camera with screenshot       .

Change GeoObject images on touch     ,      .

Attach view toGeoObject          .

Set static view togeoObject      ,      .

Customize sensor filter          .

Simple AR camera with aradar view     ,     .

Using BeyondarLocationManager       .

  BeyondAR          .

<! Minimum permissions for Beyondar>

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



<! For Beyondar this is not mandatory unless you want toload something from Internet (for instance images)>

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



<! BeyondAR needs the following features>

<uses-feature android:name="android.hardware.camera/>

<uses-feature android:name="android.hardware.sensor.accelerometer/>

<uses-feature android:name="android.hardware.sensor.compass/>

 SimpleCameraActivity,     ,   .

package com.beyondar. example;



import android. os.Bundle;

import android.support.v4.app.FragmentActivity;

import android.view. Window;



import com.beyondar.android.fragment.BeyondarFragmentSupport;

import com.beyondar.android. world. World;



public class SimpleCameraActivity extends FragmentActivity{



private BeyondarFragmentSupport mBeyondarFragment;

private World mWorld;



/** Called when the activity is first created.*/

@Override

public void onCreate (Bundle savedInstanceState){

super. onCreate (savedInstanceState);



// Hide the window title.

requestWindowFeature (Window. FEATURE_NO_TITLE);



setContentView(R.layout.simple_camera);



mBeyondarFragment = (BeyondarFragmentSupport) getSupportFragmentManager().findFragmentById(R.id.beyondarFragment);



// We create the world and fillit

mWorld = CustomWorldHelper.generateObjects (this);

// and send it tothe fragment

mBeyondarFragment.setWorld (mWorld);



// We also can see the Frames per seconds

mBeyondarFragment.showFPS (true);

}



}

  onCreate   BeyondarFragmentSupport,      BeyondarGLSurfaceView,   .

    .

<?xml version=1.0 encoding=utf-8?>

<FrameLayout xmlns: android="http://schemas.android.com/apk/res/android"

android: layout_width=match_parent

android: layout_height=match_parent

android: id="@+id/parentFrameLayout>



<fragment

android: id="@+id/beyondarFragment

android:name="com.beyondar.android.fragment.BeyondarFragmentSupport

android: layout_width=match_parent

android: layout_height=match_parent/>



</FrameLayout>

   World    ,     BeyondarFragmentSupport.

 mBeyondarFragment.showFPS (true)        .

        CustomWorldHelper.

    World,     ,      GeoObject,    World.

public static World sharedWorld;



sharedWorld = new World (context);

sharedWorld.setGeoPosition (41.90533734214473d, 2.565848038959814d);



GeoObject go4 = new GeoObject (4l);

go4.setGeoPosition (41.90518862002349d, 2.565662767707665d);

go4.setImageUri("assets://creature_7.png);

go4.setName (Image from assets);



sharedWorld.addBeyondarObject (go4);



   World   ,  CustomWorldHelper,     .  ,    World  .

     Fused location provider API (Android API Level> v9, Android Build Tools> v21).

   CustomWorldHelper, GoogleMapActivity SimpleCameraActivity.

import android.annotation.SuppressLint;

import android.content.Context;

import android. location. Location;

import android.widget.Toast;



import com.beyondar.android.world.GeoObject;

import com.beyondar.android. world. World;



@SuppressLint (SdCardPath)

public class CustomWorldHelper{

public static final int LIST_TYPE_EXAMPLE_1=1;



public static World sharedWorld;



public static World generateObjects (Context context, Location mCurrentLocation){

sharedWorld = new World (context);

// The user can set the default bitmap. This is useful if youare

// loading images form Internet and the connection getlost



sharedWorld.setDefaultImage(R.drawable.beyondar_default_unknow_icon);

// User position (you can change it using the GPS listeners form Android

//API)

if (mCurrentLocation== null){

mCurrentLocation=new Location ();

mCurrentLocation.setLatitude (41.90533734214473d);

mCurrentLocation.setLongitude (2.565848038959814d);

}



sharedWorld.setGeoPosition(mCurrentLocation.getLatitude(),mCurrentLocation.getLongitude());



// Create an object with an image inthe app resources.

// And the same goes for the app assets

GeoObject go = new GeoObject (1l);

go.setGeoPosition(mCurrentLocation.getLatitude()+0.00005,mCurrentLocation.getLongitude () -0.0001);

go.setImageUri("assets://creature_7.png);

go.setName (Image from assets);



// Add the GeoObjects tothe world

sharedWorld.addBeyondarObject (go);



return sharedWorld;

}



}

import android.content.pm.PackageManager;

import android. location. Location;

import android. os.Bundle;

import android.support.annotation.NonNull;

import android.support.annotation.Nullable;

import android.support.v4.app.ActivityCompat;

import android.support.v4.app.FragmentActivity;

import android.widget.Toast;



import com.beyondar.android.plugin. googlemap. GoogleMapWorldPlugin;

import com.beyondar.android.world.GeoObject;

import com.beyondar.android. world. World;

import com.google.android.gms.common.ConnectionResult;

import com.google.android.gms.common. api. GoogleApiClient;

import com.google.android.gms. location. LocationListener;

import com.google.android.gms. location. LocationRequest;

import com.google.android.gms. location. LocationServices;

import com.google.android.gms.maps.CameraUpdateFactory;

import com.google.android.gms.maps. GoogleMap;

import com.google.android.gms.maps. GoogleMap. OnMarkerClickListener;

import com.google.android.gms.maps. OnMapReadyCallback;

import com.google.android.gms.maps.SupportMapFragment;

import com.google.android.gms.maps.model.Marker;



public class GoogleMapActivity extends FragmentActivity implements OnMarkerClickListener, OnMapReadyCallback, LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient. OnConnectionFailedListener{



private GoogleMap mMap;

private GoogleMapWorldPlugin mGoogleMapPlugin;

private World mWorld;

GoogleApiClient mGoogleApiClient;

Location mCurrentLocation;

LocationRequest mLocationRequest;



@Override

protected void onCreate (Bundle savedInstanceState){

super. onCreate (savedInstanceState);

setContentView(R.layout.map_google);



((SupportMapFragment) getSupportFragmentManager () .findFragmentById(R.id.map)).getMapAsync (this);



buildGoogleApiClient();

}



/**

* Builds aGoogleApiClient. Uses the {@code #addApi} method torequestthe

* LocationServicesAPI.

*/

protected synchronized void buildGoogleApiClient (){

mGoogleApiClient = new GoogleApiClient. Builder (this)

.addConnectionCallbacks (this)

.addOnConnectionFailedListener (this)

.addApi (LocationServices.API)

.build();

createLocationRequest();

}



protected void createLocationRequest (){

mLocationRequest = LocationRequest.create();



// Sets the desired interval for active location updates. This intervalis

// inexact. You may not receive updates at all if no location sources are available,or

// you may receive them slower than requested. You may also receive updates fasterthan

// requested if other applications are requesting location at afaster interval.

mLocationRequest.setInterval (10000);



// Sets the fastest rate for active location updates. This interval is exact, andyour

// application will never receive updates faster than this value.

mLocationRequest.setFastestInterval (5000);



mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

}



@Override

public void onStart (){

super. onStart();

mGoogleApiClient.connect();

}



@Override

public void onStop (){

super. onStop();

mGoogleApiClient. disconnect();

}



@Override

public void onResume (){

super. onResume();



// Within {@code onPause ()}, we pause location updates, but leavethe

// connection toGoogleApiClient intact. Here, we resume receiving

// location updates if the user has requested them.



if (mGoogleApiClient.isConnected ()){

startLocationUpdates();

}

}



@Override

protected void onPause (){

super. onPause();

// Stop location updates tosave battery, but dont disconnect the GoogleApiClient object.

if (mGoogleApiClient.isConnected ()){

stopLocationUpdates();

}

}



protected void startLocationUpdates (){



if (ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_COARSE_LOCATION)!= PackageManager.PERMISSION_GRANTED){



return;

}

LocationServices.FusedLocationApi.requestLocationUpdates(

mGoogleApiClient, mLocationRequest, this);

}



/**

* Removes location updates from the FusedLocationApi.

*/

protected void stopLocationUpdates (){

// It is agood practice toremove location requests when the activity is inapausedor

// stopped state. Doing so helps battery performance and is especially

// recommended inapplications that request frequent location updates.



// The final argument to{@code requestLocationUpdates ()} is aLocationListener

// (http://developer.android.com/reference/com/google/android/gms/location/LocationListener.html).



LocationServices.FusedLocationApi.removeLocationUpdates (mGoogleApiClient, this);

}



@Override

public boolean onMarkerClick (Marker marker){

// Toget the GeoObject that owns the marker we use the following

// method:

GeoObject geoObject = mGoogleMapPlugin.getGeoObjectOwner (marker);

if (geoObject!= null){

Toast.makeText (this, Click on amarker owned byaGeoOject with the name: " +geoObject.getName(),

Toast.LENGTH_SHORT).show();

}

return false;

}



@Override

public void onMapReady (GoogleMap googleMap){

mMap=googleMap;

// We create the world and fill the world

mWorld = CustomWorldHelper.generateObjects (this, mCurrentLocation);



// As we want touse GoogleMaps, we are going tocreate the pluginand

// attach it tothe World

mGoogleMapPlugin = new GoogleMapWorldPlugin (this);

// Then we need toset the map intothe GoogleMapPlugin

mGoogleMapPlugin.setGoogleMap (mMap);

// Now that we have the plugin created lets add it toour world.

// NOTE: It is better toload the plugins before start adding object intothe world.

mWorld.addPlugin (mGoogleMapPlugin);



mMap.setOnMarkerClickListener (this);



mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mGoogleMapPlugin.getLatLng (), 15));

mMap.animateCamera (CameraUpdateFactory. zoomTo (19), 2000, null);



// Lets add the user position

GeoObject user = new GeoObject (1000l);

user.setGeoPosition(mWorld.getLatitude (), mWorld.getLongitude());

user.setImageResource (R. drawable. flag);

user.setName (User position);

mWorld.addBeyondarObject (user);

}



@Override

public void onConnected (@Nullable Bundle bundle){



if (ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_COARSE_LOCATION)!= PackageManager.PERMISSION_GRANTED){



return;

}

Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation (mGoogleApiClient);

if (mLastLocation!= null){

mCurrentLocation = mLastLocation;

String lat = String.valueOf(mCurrentLocation.getLatitude());

String lon = String.valueOf(mCurrentLocation.getLongitude());

Toast toast = Toast.makeText (this, Last location +lat + " " +lon, Toast. LENGTH_LONG);

toast.show();



mWorld.clearWorld();

mMap.clear();

mWorld = CustomWorldHelper.generateObjects (this, mCurrentLocation);

mGoogleMapPlugin = new GoogleMapWorldPlugin (this);

mGoogleMapPlugin.setGoogleMap (mMap);

mWorld.addPlugin (mGoogleMapPlugin);

mMap.setOnMarkerClickListener (this);



mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mGoogleMapPlugin.getLatLng (), 15));

mMap.animateCamera (CameraUpdateFactory. zoomTo (19), 2000, null);

GeoObject user = new GeoObject (1000l);

user.setGeoPosition(mWorld.getLatitude (), mWorld.getLongitude());

user.setImageResource (R. drawable. flag);

user.setName (User position);

mWorld.addBeyondarObject (user);

} else{

startLocationUpdates();

}

}



@Override

public void onConnectionSuspended (int i){



}



@Override

public void onConnectionFailed (@NonNull ConnectionResult connectionResult){



}



@Override

public void onLocationChanged (Location location){

mCurrentLocation = location;

String lat = String.valueOf(mCurrentLocation.getLatitude());

String lon = String.valueOf(mCurrentLocation.getLongitude());

Toast toast = Toast.makeText (this,Current location " +lat+" "+lon, Toast. LENGTH_LONG);

toast.show();

mWorld.clearWorld();

mMap.clear();

mWorld = CustomWorldHelper.generateObjects (this, mCurrentLocation);

mGoogleMapPlugin = new GoogleMapWorldPlugin (this);

mGoogleMapPlugin.setGoogleMap (mMap);

mWorld.addPlugin (mGoogleMapPlugin);

mMap.setOnMarkerClickListener (this);



mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mGoogleMapPlugin.getLatLng (), 15));

mMap.animateCamera (CameraUpdateFactory. zoomTo (19), 2000, null);

GeoObject user = new GeoObject (1000l);

user.setGeoPosition(mWorld.getLatitude (), mWorld.getLongitude());

user.setImageResource (R. drawable. flag);

user.setName (User position);

mWorld.addBeyondarObject (user);

}

}

import android.content.pm.PackageManager;

import android. location. Location;

import android. os.Bundle;

import android.support.annotation.NonNull;

import android.support.annotation.Nullable;

import android.support.v4.app.ActivityCompat;

import android.support.v4.app.FragmentActivity;

import android.view. Window;

import android.widget.Toast;



import com.beyondar.android.fragment.BeyondarFragmentSupport;

import com.beyondar.android. opengl. util. LowPassFilter;

import com.beyondar.android. world. World;

import com.google.android.gms.common.ConnectionResult;

import com.google.android.gms.common. api. GoogleApiClient;

import com.google.android.gms. location. LocationListener;

import com.google.android.gms. location. LocationRequest;

import com.google.android.gms. location. LocationServices;



public class SimpleCameraActivity extends FragmentActivity implements LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient. OnConnectionFailedListener{



private BeyondarFragmentSupport mBeyondarFragment;

private World mWorld;

GoogleApiClient mGoogleApiClient;

Location mCurrentLocation;

LocationRequest mLocationRequest;



/** Called when the activity is first created.*/

@Override

public void onCreate (Bundle savedInstanceState){

super. onCreate (savedInstanceState);

// Hide the window title.

requestWindowFeature (Window. FEATURE_NO_TITLE);



setContentView(R.layout.simple_camera);



mBeyondarFragment = (BeyondarFragmentSupport) getSupportFragmentManager () .findFragmentById(R.id.beyondarFragment);



// We also can see the Frames per seconds

mBeyondarFragment.showFPS (false);



// We create the world and fillit

mWorld = CustomWorldHelper.generateObjects (this, mCurrentLocation);

// and send it tothe fragment

mBeyondarFragment.setWorld (mWorld);

LowPassFilter.ALPHA = 0.003f;



buildGoogleApiClient();

}



/**

* Builds aGoogleApiClient. Uses the {@code #addApi} method torequestthe

* LocationServicesAPI.

*/

protected synchronized void buildGoogleApiClient (){

mGoogleApiClient = new GoogleApiClient. Builder (this)

.addConnectionCallbacks (this)

.addOnConnectionFailedListener (this)

.addApi (LocationServices.API)

.build();

createLocationRequest();

}



protected void createLocationRequest (){

mLocationRequest = LocationRequest.create();



// Sets the desired interval for active location updates. This intervalis

// inexact. You may not receive updates at all if no location sources are available,or

// you may receive them slower than requested. You may also receive updates fasterthan

// requested if other applications are requesting location at afaster interval.

mLocationRequest.setInterval (10000);



// Sets the fastest rate for active location updates. This interval is exact, andyour

// application will never receive updates faster than this value.

mLocationRequest.setFastestInterval (5000);



mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

}



@Override

public void onStart (){

super. onStart();

mGoogleApiClient.connect();

}



@Override

public void onStop (){

super. onStop();

mGoogleApiClient. disconnect();

}



@Override

public void onResume (){

super. onResume();

// Within {@code onPause ()}, we pause location updates, but leavethe

// connection toGoogleApiClient intact. Here, we resume receiving

// location updates if the user has requested them.



if (mGoogleApiClient.isConnected ()){

startLocationUpdates();

}

}



@Override

protected void onPause (){

super. onPause();

// Stop location updates tosave battery, but dont disconnect the GoogleApiClient object.

if (mGoogleApiClient.isConnected ()){

stopLocationUpdates();

}

}



protected void startLocationUpdates (){



if (ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_COARSE_LOCATION)!= PackageManager.PERMISSION_GRANTED){



return;

}

LocationServices.FusedLocationApi.requestLocationUpdates(

mGoogleApiClient, mLocationRequest, this);

}



/**

* Removes location updates from the FusedLocationApi.

*/

protected void stopLocationUpdates (){

// It is agood practice toremove location requests when the activity is inapausedor

// stopped state. Doing so helps battery performance and is especially

// recommended inapplications that request frequent location updates.



// The final argument to{@code requestLocationUpdates ()} is aLocationListener

// (http://developer.android.com/reference/com/google/android/gms/location/LocationListener.html).

LocationServices.FusedLocationApi.removeLocationUpdates (mGoogleApiClient, this);

}



@Override

public void onConnected (@Nullable Bundle bundle){



if (ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission (this, android.Manifest.permission.ACCESS_COARSE_LOCATION)!= PackageManager.PERMISSION_GRANTED){

// TODO: Consider calling

// ActivityCompat#requestPermissions

// here torequest the missing permissions, and then overriding

// public void onRequestPermissionsResult (int requestCode, String [] permissions,

// int [] grantResults)

// tohandle the case where the user grants the permission. See the documentation

// for ActivityCompat#requestPermissions for more details.

return;

}

Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation (mGoogleApiClient);

if (mLastLocation!= null){

mCurrentLocation = mLastLocation;

String lat = String.valueOf(mCurrentLocation.getLatitude());

String lon = String.valueOf(mCurrentLocation.getLongitude());

Toast toast = Toast.makeText (this, Last location +lat + " " +lon, Toast. LENGTH_LONG);

toast.show();

mWorld.clearWorld();

mWorld = CustomWorldHelper.generateObjects (this, mCurrentLocation);

mBeyondarFragment.setWorld (mWorld);

} else{

startLocationUpdates();

}

}



@Override

public void onConnectionSuspended (int i){

mGoogleApiClient.connect();

}



@Override

public void onConnectionFailed (@NonNull ConnectionResult connectionResult){



}



@Override

public void onLocationChanged (Location location){

mCurrentLocation = location;

String lat = String.valueOf(mCurrentLocation.getLatitude());

String lon = String.valueOf(mCurrentLocation.getLongitude());

Toast toast = Toast.makeText (this,Current location " +lat+" "+lon, Toast. LENGTH_LONG);

toast.show();

mWorld.clearWorld();

mWorld = CustomWorldHelper.generateObjects (this, mCurrentLocation);

mBeyondarFragment.setWorld (mWorld);

}

}

       .

     BeyondAR    Creatures inCamera,     2D   ,     .

   Android Studio,   Navigation Drawer Activity.

  APK     , Gradle  :

defaultConfig{



multiDexEnabledtrue

}

dependencies{



compile 'com.android.support: multidex:1.0.0

}

android{



dexOptions{

javaMaxHeapSize4g

}

}

   :

<application



android:name="android.support.multidex.MultiDexApplication>

   beyondar-googlemap-plugin-v0.9.0.jar, beyondar-radar-plugin-v0.9.1.jar beyondar-v0.9.3.jar,     libs .

   Google Play Services.

compile 'com.google.android.gms: play-services:9.6.1

    .

<! Google maps stuff>

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

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

<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES/>



<! Minimum permissions for BeyondAR>

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

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

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



<! For BeyondAR this is not mandatory unless you want toload something from the network>

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



<! BeyondAR needs the following features>

<uses-feature android:name="android.hardware.camera/>

<uses-feature android:name="android.hardware.sensor.accelerometer/>

<uses-feature android:name="android.hardware.sensor.compass/>

  Google Map  Google API Key  .     Google Developers Console   <application>  .

<meta-data

android:name="com.google.android.geo. API_KEY

android: value=AIzaSyBcRu9Vvb7/>

   content_main.xml.

<?xml version=1.0 encoding=utf-8?>

<android.support.v4.widget.NestedScrollView

xmlns: android="http://schemas.android.com/apk/res/android"

xmlns: app="http://schemas.android.com/apk/res-auto"

xmlns: tools="http://schemas.android.com/tools"

android: layout_width=match_parent

android: layout_height=match_parent

android: paddingLeft="@dimen/activity_horizontal_margin

android: paddingRight="@dimen/activity_horizontal_margin

android: paddingTop="@dimen/activity_vertical_margin

android: paddingBottom="@dimen/activity_vertical_margin

android: fillViewport=true

android: layout_gravity=fill_vertical

app: layout_behavior="@string/appbar_scrolling_view_behavior

tools:context=".MainActivity

tools: showIn="@layout/app_bar_main

android: id="@+id/content_main

>



<RelativeLayout

android: layout_width=match_parent

android: layout_height=match_parent>



<fragment

android: id="@+id/beyondarFragment

android:name="com.beyondar.android.fragment.BeyondarFragmentSupport

android: layout_width=match_parent

android: layout_height=match_parent/>



</RelativeLayout>



</android.support.v4.widget.NestedScrollView>

    .

package com.tmsoftstudio.aryourworld;



import android. app. Dialog;

import android.content. DialogInterface;

import android.content.Intent;

import android.net.ConnectivityManager;

import android.net.NetworkInfo;

import android. os.Bundle;;

import android.support.design. widget. FloatingActionButton;

import android.support. v4.app. DialogFragment;

import android.support.v4.widget.NestedScrollView;

import android.support.v7.app.AlertDialog;

import android.view.LayoutInflater;

import android.view.View;

import android.support.design.widget.NavigationView;

import android.support.v4.view.GravityCompat;

import android.support. v4.widget. DrawerLayout;

import android.support.v7.app.ActionBarDrawerToggle;

import android.support. v7.app. AppCompatActivity;

import android.support.v7.widget.Toolbar;

import android.view.MenuItem;

import android.Manifest;

import android.content.Context;

import android.content.SharedPreferences;

import android.content.pm.PackageManager;

import android.hardware.Sensor;

import android.hardware.SensorEvent;

import android.hardware.SensorManager;

import android. location. Location;

import android.support.annotation.NonNull;

import android.support.annotation.Nullable;

import android.support.v4.app.ActivityCompat;

import android.view.ViewGroup;

import android.view.ViewTreeObserver;

import android.widget.ProgressBar;

import android. widget. RadioButton;

import android. widget. RadioGroup;

import android.widget.Toast;



import com.beyondar.android.fragment.BeyondarFragmentSupport;

import com.beyondar.android.plugin. radar. RadarView;

import com.beyondar.android.plugin. radar. RadarWorldPlugin;

import com.beyondar.android.sensor.BeyondarSensorListener;

import com.beyondar.android.sensor.BeyondarSensorManager;

import com.beyondar.android. world. World;

import com.beyondar.android. opengl. util. LowPassFilter;

import com.google.android.gms.common.ConnectionResult;

import com.google.android.gms.common. api. GoogleApiClient;

import com.google.android.gms. location. LocationListener;

import com.google.android.gms. location. LocationRequest;

import com.google.android.gms. location. LocationServices;



import org. json. JSONArray;

import org. json. JSONObject;



import java.util.Iterator;

import java.util.LinkedHashSet;

import java.util.Set;



public class MainActivity extends AppCompatActivity

implements NavigationView. OnNavigationItemSelectedListener, BeyondarSensorListener, LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient. OnConnectionFailedListener{



private BeyondarFragmentSupport mBeyondarFragment;

private World mWorld;

private RadarView mRadarView;

private RadarWorldPlugin mRadarPlugin;



private Location mCurrentLocation;

private Context context;



GoogleApiClient mGoogleApiClient;

LocationRequest mLocationRequest;



private float [] mLastAccelerometer = new float[3];

private float [] mLastMagnetometer = new float[3];

private float [] mR = new float[9];

private float [] mOrientation = new float[3];



private static boolean flagLocationUpdate=true;

private static SharedPreferences mSettings;

private Set <String> boLat=new LinkedHashSet();

private Set <String> boLon=new LinkedHashSet();



private static ProgressBar spinner;



@Override

protected void onCreate (Bundle savedInstanceState){

super. onCreate (savedInstanceState);

setContentView(R.layout.activity_main);

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

setSupportActionBar (toolbar);



spinner = (ProgressBar)findViewById(R.id.progressBar);

spinner.setVisibility (View. GONE);



DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(

this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);

drawer.addDrawerListener (toggle);

toggle.syncState();



NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);

navigationView.setNavigationItemSelectedListener (this);



final NestedScrollView nestedScrollView = (NestedScrollView)findViewById(R.id.content_main);

nestedScrollView.getViewTreeObserver().addOnGlobalLayoutListener(

new ViewTreeObserver. OnGlobalLayoutListener (){



@Override

public void onGlobalLayout (){

int height = nestedScrollView.getHeight();

int width = nestedScrollView.getWidth();

if (height> width) height=width;

if (width> height) width=height;

ViewGroup.LayoutParams params = nestedScrollView.getLayoutParams();

params. width=width;

params. height=height;

nestedScrollView.setLayoutParams (params);

nestedScrollView.getViewTreeObserver().removeGlobalOnLayoutListener (this);

}

});



context = this;

mSettings = getSharedPreferences (APP_PREFERENCES, Context.MODE_PRIVATE);



if (!mSettings.contains (BOLAT)){

SharedPreferences. Editor editor = mSettings. edit();

editor. putStringSet (BOLAT, boLat);

editor.commit();

}



if(!mSettings.contains (BOLON)){

SharedPreferences. Editor editor = mSettings. edit();

editor. putStringSet (BOLON, boLon);

editor.commit();

}



if(!mSettings.contains (CREATURES)){

JSONArray creatures = new JSONArray();

SharedPreferences. Editor editor = mSettings. edit();

editor.putString("CREATURES",creatures.toString());

editor.commit();

}



if(!mSettings.contains (USERLON)){

SharedPreferences. Editor editor = mSettings. edit();

editor. putString (USERLON, 82.9346);

editor.commit();

}

if(!mSettings.contains (USERLAT)){

SharedPreferences. Editor editor = mSettings. edit();

editor. putString (USERLAT, 55.0415);

editor.commit();

}



checkPermissions();



mBeyondarFragment = (BeyondarFragmentSupport) getSupportFragmentManager().findFragmentById(R.id.beyondarFragment);



mRadarView = (RadarView) findViewById(R.id.radarView);

mRadarPlugin = new RadarWorldPlugin (this);

mRadarPlugin.setRadarView (mRadarView);

mRadarPlugin.setMaxDistance (100);



CustomWorldHelper.setActivity (this);

mWorld = CustomWorldHelper.generateObjects (this);

mWorld.addPlugin (mRadarPlugin);

mBeyondarFragment.setWorld (mWorld);



LowPassFilter.ALPHA = 0.001f;



BeyondarSensorManager.registerSensorListener (this);

mBeyondarFragment.setMaxDistanceToRender (10);



FloatingActionButton fabAdd = (FloatingActionButton) findViewById(R.id.fabAdd);

fabAdd.setOnClickListener (new View. OnClickListener (){

@Override

public void onClick (View view){

SelectCreatureDialogFragment dialog = new SelectCreatureDialogFragment();

dialog.show (getSupportFragmentManager (), SelectCreatureDialogFragment);




  .


   .

   ,     (https://www.litres.ru/timur-mashnin/razrabotka-android-prilozheniy-s-augmented-reality/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


