Friday, September 30, 2016

Creating GPS App

hi friend September is ending and October on their way 2016 is few month left..
and if you wandering how to made GPS app in android . I'll show it to you.

for this tutorials I assume that you already have a familiar with android application interface for the implementation , you know the R.id and blabla... whatever you like do describe the component in the XML and map it in Java @ Android Studio.

okay let gets Start it.

explanation 
in playing with GPS ( Location Provider ) we had two type  Location provider but before that we have to create permission for our Application to access device location provider by implement this line:

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

in our "AndroidManifest.xml" file.



now we ready to access the location provider:
in location provider we had two location provider:
you can click that link for how to access the location provider.

and if you get the Latitude and Longitude from the Location provider you can implement it in several ways.. like Google Map API .


okay friend that all for today .. if you had better way please let me know. and share it with us.

have a nice try.

remember friend
"The biggest failure in life is to die without ever tried"




Creating GPS App : Network Location Provider

friend in accessing location provider there is two location provider :
  • GPS Provider
  • Network Provider
now we will talk about Network Provider. before we begin we had to implement the permission in "AndroidManifest.xml" file.

and back to Network Provider.
 we have to create LocationManager and LocationListener and don't forget to check the permission.

LocationManager:
LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

Check the permission:
int permissionCheck = ContextCompat.checkSelfPermission(MapsActivity.this
Manifest.permission.ACCESS_FINE_LOCATION);

and to get the location we can access it by:
Location locationNet = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

then we can access the Network Location Provider  Latitude and Longitude with

locationNet.getLatitude(); 
and

locationNet.getLongitude();

with double value type as return.

okay done for Location Provider with Network Provider

good luck friends. ^__^

"The biggest failure in life is to die without ever tried"


Creating GPS App : GPS Location Provider

friend in accessing location provider there is two location provider :
  • GPS Provider
  • Network Provider
now we will talk about GPS Provider. before we begin we had to implement the permission in "AndroidManifest.xml" file.

and back to GPS Provider.
 we have to create LocationManager and LocationListener and don't forget to check the permission.

LocationManager:
LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

LocationListener:
LocationListener locationListener = new MyGPS(); 

MyGPS class is my personal class that implements Location Listener then in that class I overide methods..

@Overridepublic void onLocationChanged(Location loc) {
    String longitude = "Longitude: " + loc.getLongitude();
    String latitude = "Latitude: " + loc.getLatitude();
   }
 

Check the permission:
int permissionCheck = ContextCompat.checkSelfPermission(MapsActivity.this
Manifest.permission.ACCESS_FINE_LOCATION);

and set Location Request Updates:
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 500, 1, locationListener);

500 is long type value of minimum time to update. and
1 is float type value of minimum distance to update.


and to get the location we can access it by:
Location locationGPS = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

then we can access the Network Location Provider  Latitude and Longitude with

locationGPS.getLatitude(); 
and
locationGPS.getLongitude();

with double value type as return.

okay done for Location Provider with GPS Provider

have a very nice try friend. ^__^.

  "The biggest failure in life is to die without ever tried"

Wednesday, September 21, 2016

Export .JAR Java Library with Android Studio

Jar Lib.. How do we export to Jar Lib with Android Studio.. here what I've done to export JAR in Android Studio.

Start Your Android Studio.

Then open your Project ( I Assume that you already had a android project ).

Now "The Export "

yeah "The Export"

to export the project to JAR file in Android Studio we need to create new Module of Java Library.
how do we create the Module Java Library..

click "File > New > New Module..." like image below..



 then. select Java Library then click "Next" Button


in "Create New Module" window



type "Library name" , "Java package name", "java class name" like what you create in your project.. you can delete it afte Module is created.

then click "Finish" button.




here a sample my Java Library Module.




open the "build.gradle"





as you see that in dependencies > compile fileTree there is dir:'libs' that refer to libs directory where I store my Library .jar file for mya Java Library.

next Open Gradle Project.




click "build"



after build successful.

we can fin the library in Project directory:

Project Dir / Library Module Name / build / libs

for example my library result located:



okay friend.. that all what I can share to you.. if you had better way leave a link or notice comment..

hope it helpfull..  ^__^.