Formation aimaf-android-part2
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Formation aimaf-android-part2

  • 612 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
612
On Slideshare
612
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
15
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Android Android Training Part 2 RGUIG Saad - AIMAFlundi 21 janvier 13 1
  • 2. Android Morning Program : 1. Acess and permissions 2. Layouts and screens 3. Maps and geolocation 4. Implementation of Geolocation applundi 21 janvier 13 2
  • 3. Acess and permissions Android Permissions in Manifest A basic Android application has no permissions associated with it by default, meaning it can not do anything that would adversely impact the user experience or any data on the device. To make use of protected features of the device, you must include in your AndroidManifest.xml one or more <uses- permission> tags declaring the permissions that your application needs.lundi 21 janvier 13 3
  • 4. Acess and permissions Android Sample permissins in Manifest <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <permission android:name="lu.luxauto.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="lu.luxauto.permission.C2D_MESSAGE" /> <!-- App must have this permission to use the library --> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="com.android.vending.BILLING" />lundi 21 janvier 13 4
  • 5. Acess and permissions Android Sample permissins in Manifestlundi 21 janvier 13 5
  • 6. Acess and permissions Android Sample permissins in Manifestlundi 21 janvier 13 6
  • 7. Acess and permissions Android Sample permissinslundi 21 janvier 13 7
  • 8. Layout and screens Android Sample permissinslundi 21 janvier 13 8
  • 9. Layout and screens Android View Hierarchylundi 21 janvier 13 9
  • 10. Layout and screens Android Demolundi 21 janvier 13 10
  • 11. Map and Geolocation Android Introductionlundi 21 janvier 13 11
  • 12. Map and Geolocation Android Steps of implementation Add Map Library and User Permissions <uses-permission android:name="android.permission.INTERNET"/> <uses-library android:name="com.google.android.maps"/>lundi 21 janvier 13 12
  • 13. Map and Geolocation Android Steps of implementation Add Map Library and User Permissions <uses-permission android:name="android.permission.INTERNET"/> <uses-library android:name="com.google.android.maps"/>lundi 21 janvier 13 13
  • 14. Map and Geolocation Android Steps of implementation Map Layout <?xml version="1.0" encoding="utf-8"?> <com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey="My Map Key" />lundi 21 janvier 13 14
  • 15. Map and Geolocation Android Steps of implementation MapActivity public class MainActivity extends MapActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MapView mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); }lundi 21 janvier 13 15
  • 16. Map and Geolocation Android Steps of implementation MapActivity public class MainActivity extends MapActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MapView mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); }lundi 21 janvier 13 16
  • 17. Map and Geolocation Android Steps of implementation Make sure Build target is of type Google APIlundi 21 janvier 13 17
  • 18. Map and Geolocation Android Get Google Map Key https://developers.google.com/maps/documentation/ android/v1/mapkey?hl=fr#getdebugfingerprint https://developers.google.com/maps/documentation/ android/v1/maps-api-signup?hl=frlundi 21 janvier 13 18
  • 19. Map and Geolocation Android Get Google Map Keylundi 21 janvier 13 19
  • 20. Map and Geolocation Android App installlundi 21 janvier 13 20
  • 21. Map and Geolocation Android Steps of implementation Marker // Add Marker List<Overlay> mapOverlays = mapView.getOverlays(); Drawable drawable = this.getResources().getDrawable(R.drawable.marker); HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable, this); GeoPoint point = new GeoPoint(48856628,2370228); OverlayItem overlayitem = new OverlayItem(point, "Aimaf Formation Android", "Salut les amis! nous sommes ici :)"); itemizedoverlay.addOverlay(overlayitem); mapOverlays.add(itemizedoverlay); //Add controller and animate to GeoPoint MapController mc = mapView.getController(); MyLocationOverlay myLoc = new MyLocationOverlay(this, mapView); myLoc.enableCompass(); mapView.getOverlays().add(myLoc); mc.animateTo(point);lundi 21 janvier 13 21
  • 22. Map and Geolocation Android ScreenShotlundi 21 janvier 13 22
  • 23. Androidlundi 21 janvier 13 23