Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.42 KB | None | 0 0
  1. package com.example.bloodbankmap;
  2. import android.app.Activity;
  3. import android.os.Bundle;
  4. import android.support.v4.app.FragmentActivity;
  5. import android.util.Log;
  6. import android.widget.Toast;
  7. import com.google.android.gms.maps.SupportMapFragment;
  8. import com.google.android.gms.maps.CameraUpdateFactory;
  9. import com.google.android.gms.maps.GoogleMap;
  10. import com.google.android.gms.maps.MapFragment;
  11. import com.google.android.gms.maps.model.BitmapDescriptorFactory;
  12. import com.google.android.gms.maps.model.CameraPosition;
  13. import com.google.android.gms.maps.model.LatLng;
  14. import com.google.android.gms.maps.model.MarkerOptions;
  15.  
  16. public class ActivityMap extends FragmentActivity {
  17.  
  18. // Google Map
  19. private GoogleMap googleMap;
  20.  
  21. protected void onCreate(Bundle savedInstanceState) {
  22. super.onCreate(savedInstanceState);
  23. setContentView(R.layout.map);
  24.  
  25. try {
  26. // Loading map
  27. initilizeMap();
  28.  
  29. } catch (Exception e) {
  30. e.printStackTrace();
  31. }
  32.  
  33. }
  34.  
  35. /**
  36. * function to load map. If map is not created it will create it for you
  37. * */
  38. private void initilizeMap() {
  39. if (googleMap == null) {
  40. // googleMap = ((MapFragment) getFragmentManager().findFragmentById(
  41. //R.id.map)).getMap();
  42. googleMap = ((SupportMapFragment)(getSupportFragmentManager().findFragmentById(R.id.map))).getMap();
  43. // check if map is created successfully or not
  44. if (googleMap == null) {
  45. Toast.makeText(getApplicationContext(),
  46. "Sorry! unable to create maps", Toast.LENGTH_SHORT)
  47. .show();
  48. }
  49. }
  50. }
  51.  
  52. @Override
  53. protected void onResume() {
  54. super.onResume();
  55. initilizeMap();
  56. }
  57.  
  58. }
  59.  
  60. <?xml version="1.0" encoding="utf-8"?>
  61. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  62. android:layout_width="fill_parent"
  63. android:layout_height="fill_parent" >
  64.  
  65. <fragment
  66. android:id="@+id/map"
  67. android:name="com.google.android.gms.maps.SupportMapFragment"
  68. android:layout_width="match_parent"
  69. android:layout_height="match_parent"/>
  70.  
  71.  
  72.  
  73. <!-- <Button
  74. android:id="@+id/button10"
  75. android:layout_width="105dp"
  76. android:layout_height="wrap_content"
  77. android:layout_alignParentBottom="true"
  78. android:layout_alignParentLeft="true"
  79. android:text="View Complete Stock " /> -->
  80.  
  81. </RelativeLayout>
  82.  
  83. <?xml version="1.0" encoding="utf-8"?>
  84. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  85. package="com.example.bloodbankmap"
  86. android:versionCode="1"
  87. android:versionName="1.0" >
  88.  
  89. <permission
  90. android:name="com.example.bloodbankmap.permission.MAPS_RECEIVE"
  91. android:protectionLevel="signature" />
  92.  
  93. <uses-permission android:name="com.example.bloodbankmap.permission.MAPS_RECEIVE" />
  94.  
  95. <uses-sdk
  96. android:minSdkVersion="8"
  97. android:targetSdkVersion="17" />
  98.  
  99. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  100. <uses-permission android:name="android.permission.INTERNET" />
  101. <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
  102. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  103.  
  104. <!-- Required to show current location -->
  105. <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  106. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  107.  
  108. <!-- Required OpenGL ES 2.0. for Maps V2 -->
  109. <uses-feature
  110. android:glEsVersion="0x00020000"
  111. android:required="true" />
  112.  
  113. <!-- Requires OpenGL ES version 2 -->
  114. <uses-feature
  115. android:glEsVersion="0x00020000"
  116. android:required="true" />
  117.  
  118. <application
  119. android:allowBackup="true"
  120. android:icon="@drawable/blood"
  121. android:label="@string/app_name">
  122. <activity
  123. android:name="com.example.bloodbankmap.Launcher"
  124. android:label="@string/app_name"
  125. android:theme="@style/AppBaseTheme">
  126. <intent-filter>
  127. <action android:name="android.intent.action.MAIN" />
  128.  
  129. <category android:name="android.intent.category.LAUNCHER" />
  130. </intent-filter>
  131. </activity>
  132. <activity
  133. android:name="com.example.bloodbankmap.List"
  134. android:label="@string/app_name" >
  135.  
  136.  
  137. </activity>
  138. <activity
  139. android:name="com.example.bloodbankmap.ActivityMap"
  140. android:label="@string/app_name" >
  141. </activity>
  142.  
  143. <activity
  144. android:name="com.example.bloodbankmap.Registration"
  145. android:label="@string/app_name" >
  146. </activity>
  147.  
  148. <activity
  149. android:name="com.example.bloodbankmap.Area"
  150. android:label="@string/app_name" >
  151. </activity>
  152.  
  153. <activity
  154. android:name="com.example.bloodbankmap.Disp_bb"
  155. android:label="@string/app_name" >
  156. </activity>
  157.  
  158. <activity
  159. android:name="com.example.bloodbankmap.Nearest_BB"
  160. android:label="@string/app_name" >
  161. </activity>
  162.  
  163. <activity
  164. android:name="com.example.bloodbankmap.Notifications"
  165. android:label="@string/app_name" >
  166. </activity>
  167.  
  168. <activity
  169. android:name="com.example.bloodbankmap.Notify"
  170. android:label="@string/app_name" >
  171. </activity>
  172.  
  173. <activity
  174. android:name="com.example.bloodbankmap.SByBlgrp"
  175. android:label="@string/app_name" >
  176. </activity>
  177.  
  178.  
  179. <!-- Goolge API Key -->
  180. <meta-data
  181. android:name="com.google.android.maps.v2.API_KEY"
  182. android:value="AIzaSyD-0S4belIQQUFoYL26Y_fimoS6FZ4udpE" />
  183. <meta-data
  184. android:name="com.google.android.gms.version"
  185. android:value="@integer/google_play_services_version" />
  186. </application>
  187.  
  188. </manifest>
  189.  
  190. 02-20 06:07:15.317: D/dalvikvm(1022): GC_CONCURRENT freed 272K, 15% free 2489K/2904K, paused 17ms+3ms, total 62ms
  191. 02-20 06:07:15.317: D/dalvikvm(1022): WAIT_FOR_CONCURRENT_GC blocked 46ms
  192. 02-20 06:07:15.327: I/dalvikvm-heap(1022): Grow heap (frag case) to 3.254MB for 721184-byte allocation
  193. 02-20 06:07:15.377: D/dalvikvm(1022): GC_FOR_ALLOC freed 1K, 12% free 3191K/3612K, paused 48ms, total 49ms
  194. 02-20 06:07:15.557: I/Choreographer(1022): Skipped 44 frames! The application may be doing too much work on its main thread.
  195. 02-20 06:07:15.597: D/gralloc_goldfish(1022): Emulator without GPU emulation detected.
  196. 02-20 06:07:52.841: D/dalvikvm(1161): GC_FOR_ALLOC freed 251K, 14% free 2489K/2884K, paused 36ms, total 38ms
  197. 02-20 06:07:52.841: I/dalvikvm-heap(1161): Grow heap (frag case) to 3.253MB for 721184-byte allocation
  198. 02-20 06:07:52.901: D/dalvikvm(1161): GC_FOR_ALLOC freed 2K, 12% free 3191K/3592K, paused 49ms, total 49ms
  199. 02-20 06:07:52.961: D/dalvikvm(1161): GC_CONCURRENT freed <1K, 12% free 3191K/3592K, paused 5ms+25ms, total 65ms
  200. 02-20 06:07:53.101: I/Choreographer(1161): Skipped 33 frames! The application may be doing too much work on its main thread.
  201. 02-20 06:07:53.151: D/gralloc_goldfish(1161): Emulator without GPU emulation detected.
  202. 02-20 06:07:55.442: I/Choreographer(1161): Skipped 57 frames! The application may be doing too much work on its main thread.
  203. 02-20 06:07:55.811: I/Choreographer(1161): Skipped 399 frames! The application may be doing too much work on its main thread.
  204. 02-20 06:07:55.841: D/dalvikvm(1161): GC_CONCURRENT freed 731K, 24% free 2858K/3732K, paused 6ms+43ms, total 163ms
  205. 02-20 06:07:57.901: I/Choreographer(1161): Skipped 2434 frames! The application may be doing too much work on its main thread.
  206. 02-20 06:07:58.231: I/Choreographer(1161): Skipped 70 frames! The application may be doing too much work on its main thread.
  207. 02-20 06:07:58.392: I/Choreographer(1161): Skipped 175 frames! The application may be doing too much work on its main thread.
  208. 02-20 06:07:58.571: I/Choreographer(1161): Skipped 42 frames! The application may be doing too much work on its main thread.
  209. 02-20 06:07:59.131: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  210. 02-20 06:07:59.181: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  211. 02-20 06:07:59.241: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  212. 02-20 06:07:59.281: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  213. 02-20 06:07:59.321: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  214. 02-20 06:07:59.351: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  215. 02-20 06:07:59.391: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  216. 02-20 06:07:59.422: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  217. 02-20 06:07:59.461: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  218. 02-20 06:07:59.651: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  219. 02-20 06:07:59.681: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  220. 02-20 06:07:59.781: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  221. 02-20 06:07:59.821: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  222. 02-20 06:07:59.902: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  223. 02-20 06:07:59.961: W/GooglePlayServicesUtil(1161): Google Play services out of date. Requires 4242000 but found 3136130
  224. 02-20 06:08:00.021: D/dalvikvm(1161): GC_CONCURRENT freed 317K, 20% free 2993K/3732K, paused 15ms+58ms, total 255ms
  225. 02-20 06:08:00.081: I/Choreographer(1161): Skipped 157 frames! The application may be doing too much work on its main thread.
  226. 02-20 06:08:00.351: I/Choreographer(1161): Skipped 128 frames! The application may be doing too much work on its main thread.
  227. 02-20 06:08:00.641: I/Choreographer(1161): Skipped 30 frames! The application may be doing too much work on its main thread.
  228. 02-20 06:56:51.331: E/Trace(1652): error opening trace file: No such file or directory (2)
  229. 02-20 06:56:51.991: D/dalvikvm(1652): GC_FOR_ALLOC freed 262K, 14% free 2489K/2892K, paused 87ms, total 89ms
  230. 02-20 06:56:52.001: I/dalvikvm-heap(1652): Grow heap (frag case) to 3.253MB for 721184-byte allocation
  231. 02-20 06:56:52.061: D/dalvikvm(1652): GC_FOR_ALLOC freed 2K, 12% free 3191K/3600K, paused 54ms, total 54ms
  232. 02-20 06:56:52.131: D/dalvikvm(1652): GC_CONCURRENT freed <1K, 12% free 3191K/3600K, paused 5ms+4ms, total 71ms
  233. 02-20 06:56:52.301: I/Choreographer(1652): Skipped 38 frames! The application may be doing too much work on its main thread.
  234. 02-20 06:56:52.331: D/gralloc_goldfish(1652): Emulator without GPU emulation detected.
  235. 02-20 06:56:54.451: I/Choreographer(1652): Skipped 43 frames! The application may be doing too much work on its main thread.
  236. 02-20 06:56:54.801: I/Choreographer(1652): Skipped 382 frames! The application may be doing too much work on its main thread.
  237. 02-20 06:56:54.821: D/dalvikvm(1652): GC_CONCURRENT freed 731K, 24% free 2858K/3732K, paused 5ms+22ms, total 146ms
  238. 02-20 06:56:55.001: I/Choreographer(1652): Skipped 44 frames! The application may be doing too much work on its main thread.
  239. 02-20 06:56:55.651: I/Choreographer(1652): Skipped 45 frames! The application may be doing too much work on its main thread.
  240. 02-20 06:56:56.032: I/Choreographer(1652): Skipped 99 frames! The application may be doing too much work on its main thread.
  241. 02-20 06:57:03.691: I/Choreographer(1652): Skipped 105 frames! The application may be doing too much work on its main thread.
  242. 02-20 06:57:04.301: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  243. 02-20 06:57:04.351: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  244. 02-20 06:57:04.411: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  245. 02-20 06:57:04.441: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  246. 02-20 06:57:04.491: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  247. 02-20 06:57:04.531: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  248. 02-20 06:57:04.581: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  249. 02-20 06:57:04.611: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  250. 02-20 06:57:04.651: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  251. 02-20 06:57:04.881: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  252. 02-20 06:57:04.931: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  253. 02-20 06:57:05.082: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  254. 02-20 06:57:05.131: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  255. 02-20 06:57:05.231: D/dalvikvm(1652): GC_CONCURRENT freed 292K, 20% free 2987K/3732K, paused 6ms+38ms, total 256ms
  256. 02-20 06:57:05.241: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  257. 02-20 06:57:05.291: W/GooglePlayServicesUtil(1652): Google Play services out of date. Requires 4242000 but found 3136130
  258. 02-20 06:57:05.371: I/Choreographer(1652): Skipped 71 frames! The application may be doing too much work on its main thread.
  259. 02-20 06:57:05.681: I/Choreographer(1652): Skipped 114 frames! The application may be doing too much work on its main thread.
  260. 02-20 06:57:07.101: I/Choreographer(1652): Skipped 70 frames! The application may be doing too much work on its main thread.
  261. 02-20 06:57:07.271: I/Choreographer(1652): Skipped 45 frames! The application may be doing too much work on its main thread.
  262. 02-20 06:57:14.221: I/Choreographer(1652): Skipped 55 frames! The application may be doing too much work on its main thread.
  263. 02-20 06:57:14.971: I/Choreographer(1652): Skipped 51 frames! The application may be doing too much work on its main thread.
  264. 02-20 06:57:15.516: I/Choreographer(1652): Skipped 87 frames! The application may be doing too much work on its main thread.
  265. 02-20 06:57:16.541: I/Choreographer(1652): Skipped 30 frames! The application may be doing too much work on its main thread.
  266. 02-20 06:57:17.311: I/Choreographer(1652): Skipped 48 frames! The application may be doing too much work on its main thread.
  267. 02-20 07:35:21.421: D/dalvikvm(1811): GC_CONCURRENT freed 281K, 15% free 2491K/2916K, paused 17ms+6ms, total 105ms
  268. 02-20 07:35:21.421: D/dalvikvm(1811): WAIT_FOR_CONCURRENT_GC blocked 33ms
  269. 02-20 07:35:21.442: I/dalvikvm-heap(1811): Grow heap (frag case) to 3.256MB for 721184-byte allocation
  270. 02-20 07:35:21.492: D/dalvikvm(1811): GC_FOR_ALLOC freed 4K, 12% free 3191K/3624K, paused 46ms, total 46ms
  271. 02-20 07:35:21.751: I/Choreographer(1811): Skipped 43 frames! The application may be doing too much work on its main thread.
  272. 02-20 07:35:21.781: D/gralloc_goldfish(1811): Emulator without GPU emulation detected.
  273. 02-20 07:35:23.801: I/Choreographer(1811): Skipped 61 frames! The application may be doing too much work on its main thread.
  274. 02-20 07:35:24.181: D/dalvikvm(1811): GC_CONCURRENT freed 731K, 24% free 2854K/3728K, paused 6ms+70ms, total 146ms
  275. 02-20 07:35:24.201: I/Choreographer(1811): Skipped 462 frames! The application may be doing too much work on its main thread.
  276. 02-20 07:35:24.391: I/Choreographer(1811): Skipped 36 frames! The application may be doing too much work on its main thread.
  277. 02-20 07:35:24.941: I/Choreographer(1811): Skipped 35 frames! The application may be doing too much work on its main thread.
  278. 02-20 07:35:25.351: I/Choreographer(1811): Skipped 101 frames! The application may be doing too much work on its main thread.
  279. 02-20 07:35:25.982: I/Choreographer(1811): Skipped 62 frames! The application may be doing too much work on its main thread.
  280. 02-20 07:35:26.501: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  281. 02-20 07:35:26.551: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  282. 02-20 07:35:26.581: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  283. 02-20 07:35:26.631: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  284. 02-20 07:35:26.671: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  285. 02-20 07:35:26.711: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  286. 02-20 07:35:26.751: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  287. 02-20 07:35:26.781: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  288. 02-20 07:35:26.821: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  289. 02-20 07:35:26.981: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  290. 02-20 07:35:27.001: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  291. 02-20 07:35:27.241: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  292. 02-20 07:35:27.281: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  293. 02-20 07:35:27.361: D/dalvikvm(1811): GC_CONCURRENT freed 276K, 20% free 3003K/3728K, paused 69ms+48ms, total 281ms
  294. 02-20 07:35:27.372: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  295. 02-20 07:35:27.411: W/GooglePlayServicesUtil(1811): Google Play services out of date. Requires 4242000 but found 3136130
  296. 02-20 07:35:27.502: I/Choreographer(1811): Skipped 87 frames! The application may be doing too much work on its main thread.
  297. 02-20 07:35:27.771: I/Choreographer(1811): Skipped 99 frames! The application may be doing too much work on its main thread.
  298. 02-20 07:35:29.351: I/Choreographer(1811): Skipped 30 frames! The application may be doing too much work on its main thread.
  299. 02-20 07:35:30.241: D/AndroidRuntime(1811): Shutting down VM
  300. 02-20 07:35:30.251: W/dalvikvm(1811): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
  301.  
  302. 02-20 07:35:30.271: E/AndroidRuntime(1811): FATAL EXCEPTION: main
  303. 02-20 07:35:30.271: E/AndroidRuntime(1811): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms flg=0x80000 pkg=com.android.vending }
  304. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
  305. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
  306. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.app.Activity.startActivityForResult(Activity.java:3370)
  307. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.app.Activity.startActivityForResult(Activity.java:3331)
  308. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:839)
  309. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.app.Activity.startActivity(Activity.java:3566)
  310. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.app.Activity.startActivity(Activity.java:3534)
  311. 02-20 07:35:30.271: E/AndroidRuntime(1811): at com.google.android.gms.dynamic.a$5.onClick(Unknown Source)
  312. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.view.View.performClick(View.java:4204)
  313. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.view.View$PerformClick.run(View.java:17355)
  314. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.os.Handler.handleCallback(Handler.java:725)
  315. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.os.Handler.dispatchMessage(Handler.java:92)
  316. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.os.Looper.loop(Looper.java:137)
  317. 02-20 07:35:30.271: E/AndroidRuntime(1811): at android.app.ActivityThread.main(ActivityThread.java:5041)
  318. 02-20 07:35:30.271: E/AndroidRuntime(1811): at java.lang.reflect.Method.invokeNative(Native Method)
  319. 02-20 07:35:30.271: E/AndroidRuntime(1811): at java.lang.reflect.Method.invoke(Method.java:511)
  320. 02-20 07:35:30.271: E/AndroidRuntime(1811): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  321. 02-20 07:35:30.271: E/AndroidRuntime(1811): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  322. 02-20 07:35:30.271: E/AndroidRuntime(1811): at dalvik.system.NativeStart.main(Native Method)
  323. 02-20 07:35:33.941: D/dalvikvm(1825): GC_CONCURRENT freed 250K, 14% free 2589K/2984K, paused 74ms+4ms, total 156ms
  324. 02-20 07:35:34.101: I/Choreographer(1825): Skipped 127 frames! The application may be doing too much work on its main thread.
  325. 02-20 07:35:34.111: D/gralloc_goldfish(1825): Emulator without GPU emulation detected.
  326. 02-20 07:35:34.373: I/Choreographer(1825): Skipped 213 frames! The application may be doing too much work on its main thread.
  327. 02-20 07:35:35.283: I/Choreographer(1825): Skipped 88 frames! The application may be doing too much work on its main thread.
  328. 02-20 07:35:36.031: I/Choreographer(1825): Skipped 92 frames! The application may be doing too much work on its main thread.
  329. 02-20 07:35:36.081: I/Choreographer(1825): Skipped 43 frames! The application may be doing too much work on its main thread.
  330. 02-20 07:35:36.191: I/Choreographer(1825): Skipped 32 frames! The application may be doing too much work on its main thread.
  331. 02-20 07:35:36.281: I/Choreographer(1825): Skipped 36 frames! The application may be doing too much work on its main thread.
  332. 02-20 07:35:36.684: I/Choreographer(1825): Skipped 88 frames! The application may be doing too much work on its main thread.
  333. 02-20 07:35:36.831: I/Choreographer(1825): Skipped 98 frames! The application may be doing too much work on its main thread.
  334.  
  335. public class MainActivity extends FragmentActivity {
  336.  
  337. private static final int GPS_ERRORDIALOG_REQUEST = 9001;
  338. GoogleMap mMap;
  339. MapView mMapView;
  340.  
  341. @Override
  342. protected void onCreate(Bundle savedInstanceState) {
  343. super.onCreate(savedInstanceState);
  344.  
  345. if (servicesOK()) {
  346. Toast.makeText(this, "Ready to map!", Toast.LENGTH_SHORT).show();
  347. setContentView(R.layout.activity_mapview);
  348.  
  349. // 1- get reference to MapView
  350. mMapView = (MapView)findViewById(R.id.map);
  351. // 2- MapView has the same life cycles as the Activity
  352. mMapView.onCreate(savedInstanceState);
  353.  
  354.  
  355. }else {
  356. setContentView(R.layout.activity_main);
  357. }
  358.  
  359. }
  360.  
  361. @Override
  362. protected void onDestroy() {
  363. super.onDestroy();
  364. mMapView.onDestroy();
  365. }
  366.  
  367. @Override
  368. protected void onPause() {
  369. super.onPause();
  370. mMapView.onPause();
  371. }
  372.  
  373. @Override
  374. protected void onResume() {
  375. super.onResume();
  376. mMapView.onResume();
  377. }
  378.  
  379. @Override
  380. protected void onSaveInstanceState(Bundle outState) {
  381. super.onSaveInstanceState(outState);
  382. mMapView.onSaveInstanceState(outState);
  383. }
  384.  
  385. @Override
  386. protected void onStart() {
  387. super.onStart();
  388. }
  389.  
  390. @Override
  391. protected void onStop() {
  392. super.onStop();
  393. }
  394.  
  395. @Override
  396. public void onLowMemory() {
  397. super.onLowMemory();
  398. mMapView.onLowMemory();
  399. }
  400.  
  401. @Override
  402. public boolean onCreateOptionsMenu(Menu menu) {
  403. // Inflate the menu; this adds items to the action bar if it is present.
  404. getMenuInflater().inflate(R.menu.main, menu);
  405. return true;
  406. }
  407.  
  408. /**
  409. * Test and check if Google Play Services is available
  410. * @return boolean
  411. */
  412. public boolean servicesOK() {
  413. int isAvailable = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
  414.  
  415. if (isAvailable == ConnectionResult.SUCCESS) {
  416. return true;
  417. }
  418. else if (GooglePlayServicesUtil.isUserRecoverableError(isAvailable)) {
  419. Dialog dialog = GooglePlayServicesUtil.getErrorDialog(isAvailable, this, GPS_ERRORDIALOG_REQUEST);
  420. dialog.show();
  421. }
  422. else {
  423. Toast.makeText(this, "Can't connect to Google Play services", Toast.LENGTH_SHORT).show();
  424. }
  425. return false;
  426. }
  427.  
  428. <?xml version="1.0" encoding="utf-8"?>
  429.  
  430. <!-- Adds a mapView to the layout -->
  431. <com.google.android.gms.maps.MapView
  432. android:id="@+id/map"
  433. android:layout_width="match_parent"
  434. android:layout_height="match_parent">
  435. </com.google.android.gms.maps.MapView>
  436.  
  437. <?xml version="1.0" encoding="utf-8"?>
  438.  
  439. <uses-sdk
  440. android:minSdkVersion="8"
  441. android:targetSdkVersion="19" />
  442.  
  443. <uses-permission android:name="com.example.gmapsapp.permission.MAPS_RECEIVE"/>
  444. <uses-permission android:name="android.permission.INTERNET"/>
  445. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  446. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  447. <uses-permission
  448. android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
  449.  
  450. <uses-feature
  451. android:glEsVersion="0x00020000"
  452. android:required="true"/>
  453.  
  454. <application
  455. android:allowBackup="true"
  456. android:icon="@drawable/ic_launcher"
  457. android:label="@string/app_name"
  458. android:theme="@style/AppTheme" >
  459. <activity
  460. android:name="com.example.gmapsapp.MainActivity"
  461. android:label="@string/app_name" >
  462. <intent-filter>
  463. <action android:name="android.intent.action.MAIN" />
  464.  
  465. <category android:name="android.intent.category.LAUNCHER" />
  466. </intent-filter>
  467. </activity>
  468.  
  469. <meta-data
  470. android:name="com.google.android.maps.v2.API_KEY"
  471. android:value="YOUR_API_KEY_IS_NOT_PUBLIC"/>
  472.  
  473. <meta-data android:name="com.google.android.gms.version"
  474. android:value="@integer/google_play_services_version" />
  475.  
  476. </application>
  477.  
  478. >Open Android Studio.
  479. >Open Your Project.
  480. >Click on Gradle (From Right Side Panel, you will see Gradle Bar)
  481. >Click on Refresh (Click on Refresh from Gradle Bar , you will see List
  482. Gradle scripts of your Project)
  483. >Click on Your Project (Your Project Name form List(root))
  484. >Click on Tasks
  485. >Click on android
  486. >Double Click on signingReport (You will get SHA1 and MD5 in Run Bar)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement