https://www.layar.com/documentation/layar-sdk/tutorial-integrate-android-sdk/
https://www.layar.com/documentation/browser/tutorials-tools/create-simple-geo-location-layer/
koleksi-copas-copas
Minggu, 31 Juli 2016
Layer at Layar For LBS
Android mempunyai dua macam jenis lokasi sendiri, yaitu coarse-location dan fine-location. Lokasi
coarse/kasar adalah lokasi user yang ditentukan lewat BTS terdekat,
mempunyai presisi yang tidak akurat, namun hemat baterai. Sedangkan
lokasi fine-location/lokasi halus, adalah lokasi user yang didapatkan
melalui GPS yang sekarang sudah umum ada di perangkat Android.
Fine-location mempunyai presisi yang lebih tinggi, namun boros baterai.
Pada Android, penentuan lokasi ini semua diatur oleh sebuah kelas yang bernama LocationManager, jadi location manager-lah yang akan menentukan kapan kita harus memakai fine-location, atau coarse-location apabila suatu saat GPS dimatikan. Location Manager juga secara otomatis akan mendeteksi perubahan lokasi yang terjadi, karena dia mempunyai semacam listener class yang bernama LocationListener. Kelas itulah yang akan memantau semua event, seperti perubahan lokasi, provider berubah, dan akan menyesuaikan pendeteksian lokasi sesuai dengan keadaan yang ada.
Layer untuk Layar
Ekosistem Layar merupakan sistem yang secara umum menjelaskan cara pemublikasian Layer pada aplikasi Layar yang telah dibangun oleh perusahan atau perorangan yang mengembangkan Layer untuk Layar. Layer pada Layar merupakan suatu informasi digital yang berupa aplikasi yang bisa dijalankan pada platform Layar melalui perangkat mobile. Aplikasi yang dimaksud adalah aplikasi yang berhubungan dengan informasi posisi objek di sekitar dengan menggunakan teknologi Augmented Reality. Cara kerja ekosistem Layar sebagai berikut.
Aplikasi ini merupakan bentuk pengimplementasian Augmented Reality di sekitar Kota Depok berupa Location Based Services (LBS) pada Android. Pengunjung yang memiliki Android dapat dengan mudah mendapatkan informasi pada objek yang terdapat di sekitar Kota Depok, hanya dengan mengaktifkan aplikasi serta mengarahkan kamera ke objek yang diinginkan.
Untuk memudahkan pengguna dalam memahami secara garis besar tentang aplikasi ini, akan dijelaskan secara garis besar mengenai aplikasi, yaitu :
sebagai berikut contoh implementasinya with teman dari finlandia...namanya "utchok nonsin aga "
http://www.twoh.co/2012/06/membuat-aplikasi-location-based-services-di-android/
http://layar.pbworks.com/w/page/7783228/FrontPage
http://www.slideshare.net/layarmobile/layar-code-examples-for-developers
https://www.layar.com/documentation/browser/layar-platform-overview/
https://www.layar.com/documentation/browser/tutorials-tools/create-simple-geo-location-layer/
Pada Android, penentuan lokasi ini semua diatur oleh sebuah kelas yang bernama LocationManager, jadi location manager-lah yang akan menentukan kapan kita harus memakai fine-location, atau coarse-location apabila suatu saat GPS dimatikan. Location Manager juga secara otomatis akan mendeteksi perubahan lokasi yang terjadi, karena dia mempunyai semacam listener class yang bernama LocationListener. Kelas itulah yang akan memantau semua event, seperti perubahan lokasi, provider berubah, dan akan menyesuaikan pendeteksian lokasi sesuai dengan keadaan yang ada.
Layer untuk Layar
Ekosistem Layar merupakan sistem yang secara umum menjelaskan cara pemublikasian Layer pada aplikasi Layar yang telah dibangun oleh perusahan atau perorangan yang mengembangkan Layer untuk Layar. Layer pada Layar merupakan suatu informasi digital yang berupa aplikasi yang bisa dijalankan pada platform Layar melalui perangkat mobile. Aplikasi yang dimaksud adalah aplikasi yang berhubungan dengan informasi posisi objek di sekitar dengan menggunakan teknologi Augmented Reality. Cara kerja ekosistem Layar sebagai berikut.
- Brand Publisher sebagai pihak/ perusahaan yang telah memiliki brand akan merencanakan untuk pembuatan sebuah content yang sekiranya akan berguna untuk masyarakat umum atau untuk istilah pemasarannya “High Quality Content”.
- Content terbaik akan diserahkan ke pihak developer (pengembang Layer) untuk membuat sebuah Layer yang disesuaikan dengan content. Dalam pembuatan sebuah Layer, developer dituntut untuk kreatif agar Layer yang dihasilkan dapat menarik perhatian pengguna.
- Layer yang telah selesai dikerjakan akan dipublikasikan ke platform Layar. Untuk pemublikasian, semua data statistik pada content dan meta data pada Layer harus dimasukkan.
- Langkah terakhir adalah pendistribusian Layer ke pengguna. Untuk menemukan Layer yang telah dipublikasikan, pengguna harus melakukan pencarian sesuai nama dari layer tersebut dengan menggunakan aplikasi Layar pada perangkat mobile. Sebuah aplikasi dalam format APK dibuat untuk pengguna agar dapat menjalankan layar dengan mengunduh aplikasi yang telah dipublikasikan di Android Market, dengan nama aplikasi adalah “me@AR”.
- Belajar Yuk
Aplikasi ini merupakan bentuk pengimplementasian Augmented Reality di sekitar Kota Depok berupa Location Based Services (LBS) pada Android. Pengunjung yang memiliki Android dapat dengan mudah mendapatkan informasi pada objek yang terdapat di sekitar Kota Depok, hanya dengan mengaktifkan aplikasi serta mengarahkan kamera ke objek yang diinginkan.
Untuk memudahkan pengguna dalam memahami secara garis besar tentang aplikasi ini, akan dijelaskan secara garis besar mengenai aplikasi, yaitu :
- Koordinat lokasi objek diambil dengan menggunakan Google Earth dalam pencarian koordinatnya.
- Informasi yang terdapat pada titik hasil lokasi objek didapatkan dengan menggunakan media internet.
- Informasi pada tiap titik lokasi objek berupa alamat, homepage, nomor telepon dan e-mail.
- Format homepage pada layar informasi titik lokasi objek merupakan website yang berisi informasi dari objek tersebut.
- Location Based Services (LBS) ini dibuat menggunakan platform Layar, Hoppala serta bahasa pemrograman PHP dan XML.
- Hasil dari Location Based Services (LBS) ini berupa bulatan-bulatan yang merupakan titik-titik lokasi yang akan tampil ketika kamera iPhone dan Android diarahkan ke posisi lokasi objek tersebut.
sebagai berikut contoh implementasinya with teman dari finlandia...namanya "utchok nonsin aga "
http://layar.pbworks.com/w/page/7783228/FrontPage
http://www.slideshare.net/layarmobile/layar-code-examples-for-developers
https://www.layar.com/documentation/browser/layar-platform-overview/
https://www.layar.com/documentation/browser/tutorials-tools/create-simple-geo-location-layer/
Layar code examples for developers
- 1. Layar code examplesfor developersCreating augmented reality experiences for the world’s leading platformAugust 2011
- 2. Note! • Please note that the code examples in this presentation are based on Layar GetPOIs API version 6.0 • Please check our wiki for more information about the changes • The Complete API version 6.0 can be found here© Layar 2011
- 3. Introduction • After you have gone through the steps as outlined in the presentation Layar introduction for developers, you can start creating your first layer • This presentation provides a few code examples for the layer service, which will deliver POI content to the Layar app • More code examples (and the latest updates) can be found on the Layar developer wiki© Layar 2011
- 4. Content • Layar Platform Architecture • Layar Features Overview • Developer API - getPOI API • Feature highlights and sample code • Interactive layers • Third party tools • Developer Support© Layar 2011
- 5. Layar architecture ns Layar n itio publishing fi de GPS data y er environment La Layar server Get layers Get POIs Create layer La Fixed yer De v data Ge elop tP e OIs r AP I View Layer service POI in forma tion provider Ge View tP POI i OI nform s ation Layer content Legend sources Layar environment© Layar 2011 Third-party environment
- 6. Layar features Overview• Support for both Geo-location POIs and Vision enabled POIs• Support for icon/images/3D models• Support for animated POIs• Sharing to facebook, Twitter and Developer’s server.• Interactive actions: call, email, share, web page, audio, video, async call etc• Gaming elements: autotriggers, relative POIs, point to point© Layar 2011
- 7. Creating layers • Layers are built using simple web technology • You can use programming languages like PHP, MySQL, Java etc as long as the response is in JSON format • 2 step process: 1. Create a layer definition in the Layar publishing environment 2. Create a layer service for delivering the POI content to the Layar app • Step by step Tutorial: Create a simple layer© Layar 2011
- 8. getPOI API • Hosted by layer developer • Simple API: • HTTP request with the following parameters • Latitude, Longitude, filter settings,... • Response: JSON data containing POI information (hotspots)© Layar 2011
- 9. Two types of POIs • Geo-location POI • POIs that are attached to a physical location with latitude, longitude & altitude. • Vision POI • Augments that are attached to a target object recognized by Layar Reality browser (v6.0 and above).© Layar 2011
- 10. Requesthttp://devAPI.example.com/getPOIs/?countryCode=IN&lon=4.887339×tamp=1249226148713&userId=ed48067cda8e1b985dbb8ff3653a2da4fd490a37&radius=6245&lat=52.377544&layerName=snowy4&accuracy=100Response{ "hotspots": [{ "id": "test_1", "anchor": { "geolocation": { "lat": 52.3729, "lon": 4.93 } }, // For Geo-location POI. "text": { "title": "The Layar Office", "description": "The Location of the Layar Office", "footnote": "Powered by Layar" }, "imageURL": "http://custom.layar.nl/layarimage.jpeg" }], "layer": "snowy4", "errorString": "ok", "errorCode": 0} © Layar 2011
- 11. • Response for Vision enabled layers { "hotspots": [{ "id": "test_1", "anchor": { "referenceImage": “my_Reference_Image” }, // For Vision enabled POI. "text": { "title": "The Layar Office", "description": "The Location of the Layar Office", "footnote": "Powered by Layar" }, "imageURL": "http://custom.layar.nl/layarimage.jpeg" }], "layer": "snowy4", "errorString": "ok", "errorCode": 0 }© Layar 2011
- 12. 3D© Layar 2011 Layer developed by Hoppala
- 13. Response{ "hotspots": [{ "id": "test_1", "anchor": { "geolocation": { "lat": 52.3729, "lon": 4.93 } }, // For Geo-location POI. "text": { "title": "The Layar Office", "description": "The Location of the Layar Office", "footnote": "Powered by Layar" }, "imageURL": "http://custom.layar.nl/layarimage.jpeg","object": { "contentType": "model/vnd.layar.l3d", "url": "http://example.com/example_full.l3d", "reducedURL": "http://example_reduced.l3d", "size": 2},"transform": { "rotate": { "rel": true, "axis": { "x": 0, "y": 0, "z": 1 }, "angle": 0 }, "translate": { "x": 0, "y": -0.075, "z": 0 }, "scale": 0.01} }], "layer": "snowy4", "errorString": "ok", "errorCode": 0} © Layar 2011
- 14. 3D notes • Base format is OBJ (WaveFront format) • Good interchange format, most 3D programs can convert to OBJ • Materials and Textures are supported • For textures only diffuse color of the material is supported • No multiple textures • Transparency support (no blending with other objects though) • Conversion to L3D (Layar binary format) required© Layar 2011
- 15. More info on 3D POI • Requirements and best practices on creating 3D model. • Presentation: 3D Content Creation Tips & Tricks • Manual: 3D in Layar v1.0 (pdf) • Layar 3D model Converter • Tutorial: Create texture-animated 3D models • Tutorial: Positioning 3D model within Layar3D Model Converter© Layar 2011
- 16. User Filter SettingsRequesthttp://examplelayer/FourthTutorial_FilterSettings.php?lang=en&countryCode=NL&lon=4.94745254517&userId=6f85d06929d160a7c8a3cc1ab4b54b87db99f74b&RADIOLIST=1&CHECKBOXLIST=1%2C2&version=4.0&radius=1500&CUSTOM_SLIDER=300000&lat=52.365852048&layerName=testlayerfilters&SEARCHBOX=&accuracy=100 © Layar 2011
- 17. More Info on Filter Settings • Filter configuration on the Publishing site • Filter definition in getPOI request • Tutorial: Layer with filter settings© Layar 2011
- 18. POI & Layer Actions There’s audio...© Layar 2011 http://www.flickr.com/photos/suzanneandsimon/886401250/
- 19. POI & Layer Actions There’s audio... “uri”: “http://mylayer.com/surroundsound.mp3”© Layar 2011 http://www.flickr.com/photos/suzanneandsimon/886401250/
- 20. Response for Geo-location POI"actions": [{" " "label": "Contact Layar", "uri": "http://layar.com/company/contact/", "autoTriggerRange": 5000, // For Geo-location POI. "autoTriggerOnly": false, "contentType": "text/html", "method": "GET", "activityType": 1, "params": [ "lat", "lon", "alt", "lang", "countrycode", "localCountryCode", "version" ], "closeBiw": false, "showActivity": true, "activityMessage": "contact layar" }] © Layar 2011
- 21. Response for Vision POI"actions": [{" " "label": "Contact Layar", "uri": "http://layar.com/company/contact/", "autoTrigger": true, // For Vision POI. "autoTriggerOnly": false, "contentType": "text/html", "method": "GET", "activityType": 1, "params": [ "lat", "lon", "alt", "lang", "countrycode", "localCountryCode", "version" ], "closeBiw": false, "showActivity": true, "activityMessage": "contact layar" }] © Layar 2011
- 22. More Info on Actions • Actions API specification • Tutorial: Layer with Actions© Layar 2011
- 23. Layar intents© Layar 2011
- 24. Layar intents layar://princeofpersia/?SEARCHBOX=start© Layar 2011
- 25. Layar Intents • Three types of intents: • Layar://<layername>/?action=<value>&<custom_param>=<value>&<filter>=<value> • http://m.layar.com/open/<layername> • layarshare://<layername>/?<parameters> • Use cases: interactive layer and point-to-point layer • Layar intents API documentation© Layar 2011
- 26. Animations© Layar 2011
- 27. Animations Texture animations© Layar 2011
- 28. Animations Texture animations Rotate© Layar 2011
- 29. Animations Texture animations Oscillate Rotate© Layar 2011
- 30. Animation API • A collection of pre-defined animations on POIs. • Simple appearance animation (drop, grow, spin) • Full customizable animation: onClick, onUpdate, onFocus, etc • Each event can have a combination of animations. • Layer level/POI level • Animation API documentation© Layar 2011
- 31. Response"animations": { // "animations" on a POI level. This overwrites the "animations" parameter defined on the layer level. "onClick": [ // "onClick" event triggers the following animation. .{ //The object size is scaled by a decimal factor from 1 to 2 on X, Y and Z axises "interpolation": "linear", "type": "scale", // animation type, mandatory field. "axis": { // axis that the animation is applied to "y": 1, "x": 1, "z": 1 }, "from": 1, // initial scale factor, default is to use the currently set POI state "to": 2, // eventual scale factor "length": 2000, // animation duration in milliseconds, mandatory field. "delay": 0, // delay in milliseconds before starting the animation "repeat": false, // specifies whether the animation is repeated in a loop "persist": true // indicates whether he end state of the animation is applied to the POI state } ]} © Layar 2011
- 32. Refresh rate moving POIs © 2010, Layar B.V. http://www.flickr.com/photos/whiteoakart/143472785/
- 33. Response{"hotspots": [], "layer": "snowy4", "errorString": "ok", "morePages": false, "errorCode": 0, "nextPageKey": null, "refreshInterval": 2,//indicates how many seconds to wait until the next getPOI request is made. "refreshDistance": 10,//tells the client to refresh the layer if the user has moved by more than the //distance specified. "fullRefresh": false, // indicates whether it is a full refresh or update. "actions":[]}Detailed explanation can be found here. © Layar 2011
- 34. Auto-triggers© Layar 2011
- 35. Auto-triggers “actions”: [{ “label”: “ Watch”, “uri”: “http://splintercell.com /explosion.3gp”, “autoTriggerRange”: 50, “autoTriggerOnly”: true}]© Layar 2011
- 36. User authenticationCookies! http://www.flickr.com/photos/mache/166940673
- 37. User authentication • Layar AR view behaves like a browser view • Cookies belonging to the getPOI URL domain are stored and sent • Implement your layer webservice like for a normal browser • Alternatively: UserId is anonymous ID of user (linked to phone ID) • User Authentication Documentation© Layar 2011
- 38. Interactive layers • Create Relative POIs • User generated POIs • User provided feedback, such as vote, comments, etc • Sharing screenshots to developer’s server • Treasure hunting (point to point)© Layar 2011
- 39. Create Relative POIs • POIs that are always relative to user’s current location • Useful when POI content is not constraint to the geo- location. • Tutorial ( sample code) is available© Layar 2011
- 40. User Generated POIs • Dynamic layer where users can create a POI in it. • Normally POI’s location is relevant to user’s location. • More info on Layar intent and actions • The Sequence Diagram explains how to insert a POI by filling in a web form within the layer.© Layar 2011
- 41. User provided Feedback • Dynamic layer which enables users to provide feedback to POIs. • For instance, users can vote for a restaurant, comment on a piece of art, etc. • The scenario in SD is that the number of a POI being “liked” is updated whenever the “like” action is triggered.© Layar 2011
- 42. Sharing screenshots to developer • User taken screenshots can be uploaded to developer’s server. • URL to post screenshots to is defined in publishing site (under API endpoint URL tab) . • Uploaded info contains screenshot, message, lat & lon where screenshot was taken are included as EXIF data in the screenshot file. • Sharing API Documentation© Layar 2011
- 43. Point-to-point layer • Dynamic layer content based on the previous interaction • Async call action and user Interact Dialog provides more interaction • For instance, treasure hunting game, new content discovery, etc. • The Sequence Diagram shows the sequence of collecting a treasure and revealing others after the treasure is collected.© Layar 2011
- 44. Play layers in any iPhone app • Binary code to be included in your Xcode project • Simple API that opens any published layer • Seamless handover to AR experience (incl. authentication) • iPhone Player Wiki documentation© Layar 2011
- 45. Sample code© Layar 2011
- 46. Third Party Tools • Instead of creating your own layer service, you can use one of the third party tools developed by the community, e.g.: • Porpoise Open source server software, requires programming skills, more control • Hoppala Augmentation Hosted solution, easy to use, limited functionality • LMS using Layar Connect, such as BuildAR, Poistr, Poiz, VISAR, etc. • Others© Layar 2011
- 47. Developer support • The following support resources provide a wealth of information for developers: • Layar developer wiki • Layar developer support environment • Discussion forums • Support tickets© Layar 2011
- 48. Thank you
android note AR
Beberapa Tools/SDK/Engine Untuk Pengembangan Aplikasi Augmented Reality
Mau share Beberapa Tools/SDK/Engine Untuk Pengembangan Aplikasi Augmented Reality. Barangkali teman-teman ada yang berminat untuk membuat aplikasi Augmented Reality, langsung cek aja linknya :
Berbasis Marker & Gambar :
ARToolKit (http://www.hitl.washington.edu/artoolkit/)
FLARToolKit (http://www.libspark.org/wiki/saqoosha/FLARToolKit/en)
FLARManager (http://words.transmote.com/wp/flarmanager/)
SLARToolKit (http://slartoolkit.codeplex.com/)
NyARToolKit (http://nyatla.jp/nyartoolkit/wp/)
D'Fusion Studio (http://www.t-immersion.com/products/dfusion-suite/dfusion-studio)
metaio Unifeye Design (http://www.metaio.com/software/design/)
IN2AR (http://in2ar.com/)
ATOMIC Authoring Tool (http://www.sologicolibre.org/projects/atomic/en/index.php)
OpenSpace3D (http://www.openspace3d.com/)
Junaio (http://www.junaio.com/)
ARmedia Augmented Reality Plugin (http://www.inglobetechnologies.com/en/)
Aurasma (http://www.aurasma.com/)
AndAR (http://code.google.com/p/andar/)
ArUco (http://www.uco.es/investiga/grupos/ava/node/26)
BazAR (http://cvlab.epfl.ch/software/bazar/index.php)
DroidAR (http://code.google.com/p/droidar/)
flare*tracker (http://www.imagination.at/en/?Products:Augmented_Reality_for_Flash:flare%2Atracker)
flare*nft (http://www.imagination.at/en/?Products:Augmented_Reality_for_Flash:flare%2Anft)
Goblin XNA (http://goblinxna.codeplex.com/)
instantreality (http://www.instantreality.org/)
iPhone ARKit (http://www.iphonear.org/)
LinceoVR (http://linceovr.seac02.it/)
Eligo (http://eligo.seac02.it/)
Minerva (http://sourceforge.net/projects/minervaproject/)
MXRToolkit (http://mxrtoolkit.sourceforge.net/)
Popcode (http://www.popcode.info/)
PTAM (http://www.robots.ox.ac.uk/~gk/PTAM/)
Qoncept AR (http://www.kudan.eu/)
Robocortex (http://www.robocortex.com/)
SSTT (http://technotecture.com/augmentedreality)
String (http://www.poweredbystring.com/)
osgART (http://osgart.org/wiki/index.php/Main_Page)
Studierstube (http://studierstube.icg.tugraz.at/main.php)
Vuforia AR (https://developer.qualcomm.com/develop/mobile-technologies/augmented-reality)
Win AR (http://r2m.nus.edu.sg/cos/o.x?c=/r2m/license_product&ptid=5730&func=viewProd&pid=22)
windage (http://code.google.com/p/windage/)
YVision (http://www.yvision.com/)
ALVAR (www.vtt.fi/multimedia/alvar.html)
Layar (http://www.layar.com/)
SATCH (https://satch.jp/en/)
buildAR (https://buildar.com/)
onvert (http://onvert.com/)
Serge (http://www.sergesdk.com)
ARmsk (http://armsk.org/)
ARLab Image Matching (http://www.arlab.com/imagematching)
Designer's AR Toolkit (http://ael.gatech.edu/lab/research/design/dart/)
Obvious Engine (http://obviousengine.com/)
PointCloud (http://pointcloud.io/)
Berbasis Lokasi :
Layar (http://www.layar.com/)
Wikitude (http://www.wikitude.com/en/)
Junaio (http://www.junaio.com/)
Aurasma (http://www.aurasma.com/)
3DAR (http://3dar.us/)
DroidAR (http://code.google.com/p/droidar/)
instantreality (http://www.instantreality.org/)
KHARMA (https://research.cc.gatech.edu/kharma/)
mixare (http://www.mixare.org/)
LibreGeoSocial (http://www.libregeosocial.org/)
buildAR (https://buildar.com/)
Look! AR (http://www.lookar.net/)
ARLab AR Browser (http://www.arlab.com/arbrowser)
Berbasis Face Tracking :
Viewdle (http://viewdle.com/index.html)
Beyond Reality Face (http://www.beyond-reality-face.com/)
metaio Unifeye Design (http://www.metaio.com/software/design/)
instantreality (http://www.instantreality.org/)
Luxand FaceSDK (http://www.luxand.com/)
SHORE (http://www.iis.fraunhofer.de/en/bf/bsy/produkte/shore/)
Motion Nexus (http://motionnexus.com/)
Berbasis Skeleton Tracking :
Kinect for Windows SDK (http://www.microsoft.com/en-us/kinectforwindows/develop/)
PrimeSense OpenNI/NITE (http://www.primesense.com/en/openni)
AIRKinect (http://www.as3nui.com/air-kinect/)
OpenSpace3D (http://www.openspace3d.com/)
Motion Nexus (http://motionnexus.com/)
http://www.priawadi.com/2012/11/beberapa-toolssdkengine-untuk.html
=============================================================
Bagi kamu para developer Android pasti sudah familiar dengan namanya Force Close. Terkadang kita bingung padahal tidak ada error pada kodingan tapi setelah di Running kok malah muncul tulisan Force Close?
Nahh berikut ada beberapa penyebab aplikasi Force Close :
- Belum menambahkan user permission di manifest
- Belum mendaftarkan activity class di manifest
- Kesalahan pengaturan fill_parent atau wrap_content pada layout
- Aplikasi terlalu lama loading
- Salah tipe casting untuk findViewById() saat mereference ui widget
- Lupa menambahkan show() pada toast
- Tidak melakukan clean project setelah debbuging di xml
- Isi database tidak muncul karena memory yang kurang
- Terlalu banyak inner layout yang menyebabkan recursive
- Kesalahan pada coloum _id untuk dbase adapter
- Belum menambahkan android:id="@id/android:list" pada listView tag di xml layout jika Activity menggunakan extend ListActivity
- Pengaturan warna di Android adalah 32 ARGB integer value
Nahh sebelum kamu jadi panic at the disco coba cek dulu beberapa kesalahan diatas. Semoga bermanfaat :)
http://www.priawadi.com/2012/11/penyebab-force-close-pada-android.html
=================
Tutorial Menampilkan CCTV Transjakarta di Android
"Telah terjadi penembakan di Masjid Al-Hurriyyah IPB pada saat sholat Jum'at dan dari informasi yang saya dari @korpusIPB ada 2 orang korban, yang merupakan UKK (Unit Keamanan Kampus) dan dinyatakan sudah meninggal dunia". Innalillahiwainnailahi rojiun, semoga mereka meninggal dalam keadaan sahid. Amiennn, #Do'a mulai....
Lanjut lagi ke pokok permasalah, yaitu bagaimana cara menampilkan CCTV nya Transjakarta dari websitenya yaitu transjakarta.co.id. Sebenarnya ini project kuliah saya dan sampai sekarang saya masih menggalau gimana caranya make algoritma A* untuk pencarian rute terdekatnya transjakarta, karena masih banyak project-project lain yang harus diselesaikan akhirnya project yang ini sedikit saya telantarkan :p. Maaf ya teman-teman T.T
Oke, karena saya lagi malas merangkai kata. Langsung saja saya bagikan source code menampilkan kamera CCTV transjakarta di ANDROID. Semoga bisa membantu teman-teman yang sedang belajar ANDROID seperti saya :D
Berikut Source codenya :
>> Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/gambar"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
></ImageView>
</LinearLayout>
Note : Untuk Main.xml kita tambahkan ImageView sebagai tempat CCTVnya nanti.
>> Activity.java
import java.io.InputStream;
import java.net.URL;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.widget.ImageView;
public class Cctv2Activity extends Activity {
ImageView iv;
Runnable jalankan;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
loadGambar();
jalankan = new Runnable() {
public void run() {
try {
loadGambar();
} catch (Exception e) {
e.printStackTrace();
}
new Handler().postDelayed(jalankan, 100);
}
};
new Handler().postDelayed(jalankan, 100);
}
private void loadGambar(){
try{
iv = (ImageView) findViewById(R.id.gambar);
URL url = new URL("http://transjakarta.co.id/haltecam/Bank_Indonesia.jpg?1337867289300");
InputStream is = (InputStream) url.getContent();
Drawable gambar = Drawable.createFromStream(is, "src");
iv.setImageDrawable(gambar);
is.close();
}catch (Exception e){
e.printStackTrace();
}
}
}
Note :
- Penjelasan untuk yang berwarna BIRU : Fungsinya untuk mer-refresh gambar CCTV transjakarta dalam 100 miliseconds. Jadi CCTV transjakarta itu dikirimkan dalam bentuk gambar yang diperbarui terus perdetiknya. Nahh jadi kita harus menggunakan fungsi ini untuk memperbarui gambar tersebut terus menerus, kalau kita tidak menggunakan fungsi ini maka gambar yang akan kita lihat tidak akan pernah berubah kecuali kalau kita keluar aplikasi dan aplikasinya kita buka kembali.
- Penjelasan untuk yang berwarna MERAH : Itu merupakan URL dari CCTV di Halte Bank Indonesia, adapun cara mendapatkannya kita tinggal Klik kanan pada gambar CCTV di website transjakarta, lalu Copy Image URL. Setelah itu Paste-kan pada URL di kodingan kita tersebut.
Terakhir, kita jangan sampai lupa untuk menambahkan permissions untuk mengaktifkan internet di Manifest.xml.
>> Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jie.coba.lagi"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="6" />
<uses-permission android:name="android.permission.INTERNET"/> <application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".Cctv2Activity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Yapzz... Mungkin hanya sebatas itu yang bisa saya share ke teman-teman. Apabila ada salah-salah kata saya mohon maaf, karena saya juga masih NEUBIE dan baru belajar ANDROID.
Skrinsut aplikasi yang dibuat :
![]() |
CCTV Halte BI |
Langganan:
Komentar (Atom)