Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

App apresentada durante a AndroidConf Brasil 2011 sobre a utilização da

Wikitude API para simular Realidade Aumentada (Augmented Reality) em
Android.
  • Loading branch information...
commit a2a6321765d464602cee61d9458dc61182b8588b 0 parents
Ramon Ribeiro Rabello authored
9 Realidoid/.classpath
... ... @@ -0,0 +1,9 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" path="src"/>
  4 + <classpathentry kind="src" path="gen"/>
  5 + <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
  6 + <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
  7 + <classpathentry kind="lib" path="libs/wikitudearintent.jar"/>
  8 + <classpathentry kind="output" path="bin/classes"/>
  9 +</classpath>
33 Realidoid/.project
... ... @@ -0,0 +1,33 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>Realidoid</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + <buildCommand>
  14 + <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
  15 + <arguments>
  16 + </arguments>
  17 + </buildCommand>
  18 + <buildCommand>
  19 + <name>org.eclipse.jdt.core.javabuilder</name>
  20 + <arguments>
  21 + </arguments>
  22 + </buildCommand>
  23 + <buildCommand>
  24 + <name>com.android.ide.eclipse.adt.ApkBuilder</name>
  25 + <arguments>
  26 + </arguments>
  27 + </buildCommand>
  28 + </buildSpec>
  29 + <natures>
  30 + <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
  31 + <nature>org.eclipse.jdt.core.javanature</nature>
  32 + </natures>
  33 +</projectDescription>
27 Realidoid/AndroidManifest.xml
... ... @@ -0,0 +1,27 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3 + package="wikitude.teste"
  4 + android:versionCode="1"
  5 + android:versionName="1.0" >
  6 +
  7 + <uses-sdk android:minSdkVersion="7" />
  8 +
  9 + <application
  10 + android:icon="@drawable/ic_launcher"
  11 + android:label="@string/app_name" >
  12 + <activity
  13 + android:label="@string/app_name"
  14 + android:name="br.com.androidnarede.realidoid.RealidoidActivity" >
  15 + <intent-filter >
  16 + <action android:name="android.intent.action.MAIN" />
  17 +
  18 + <category android:name="android.intent.category.LAUNCHER" />
  19 + </intent-filter>
  20 + </activity>
  21 + </application>
  22 +
  23 + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  24 + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  25 + <uses-permission android:name="android.permission.INTERNET" />
  26 +
  27 +</manifest>
BIN  Realidoid/bin/Realidoid.apk
Binary file not shown
BIN  Realidoid/bin/classes.dex
Binary file not shown
BIN  Realidoid/bin/res/drawable-hdpi/ic_launcher.png
BIN  Realidoid/bin/res/drawable-ldpi/ic_launcher.png
BIN  Realidoid/bin/res/drawable-mdpi/ic_launcher.png
BIN  Realidoid/bin/resources.ap_
Binary file not shown
BIN  Realidoid/libs/wikitudearintent.jar
Binary file not shown
40 Realidoid/proguard.cfg
... ... @@ -0,0 +1,40 @@
  1 +-optimizationpasses 5
  2 +-dontusemixedcaseclassnames
  3 +-dontskipnonpubliclibraryclasses
  4 +-dontpreverify
  5 +-verbose
  6 +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  7 +
  8 +-keep public class * extends android.app.Activity
  9 +-keep public class * extends android.app.Application
  10 +-keep public class * extends android.app.Service
  11 +-keep public class * extends android.content.BroadcastReceiver
  12 +-keep public class * extends android.content.ContentProvider
  13 +-keep public class * extends android.app.backup.BackupAgentHelper
  14 +-keep public class * extends android.preference.Preference
  15 +-keep public class com.android.vending.licensing.ILicensingService
  16 +
  17 +-keepclasseswithmembernames class * {
  18 + native <methods>;
  19 +}
  20 +
  21 +-keepclasseswithmembers class * {
  22 + public <init>(android.content.Context, android.util.AttributeSet);
  23 +}
  24 +
  25 +-keepclasseswithmembers class * {
  26 + public <init>(android.content.Context, android.util.AttributeSet, int);
  27 +}
  28 +
  29 +-keepclassmembers class * extends android.app.Activity {
  30 + public void *(android.view.View);
  31 +}
  32 +
  33 +-keepclassmembers enum * {
  34 + public static **[] values();
  35 + public static ** valueOf(java.lang.String);
  36 +}
  37 +
  38 +-keep class * implements android.os.Parcelable {
  39 + public static final android.os.Parcelable$Creator *;
  40 +}
11 Realidoid/project.properties
... ... @@ -0,0 +1,11 @@
  1 +# This file is automatically generated by Android Tools.
  2 +# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
  3 +#
  4 +# This file must be checked in Version Control Systems.
  5 +#
  6 +# To customize properties used by the Ant build system use,
  7 +# "ant.properties", and override values to adapt the script to your
  8 +# project structure.
  9 +
  10 +# Project target.
  11 +target=android-10
BIN  Realidoid/res/drawable-hdpi/ic_launcher.png
BIN  Realidoid/res/drawable-ldpi/ic_launcher.png
BIN  Realidoid/res/drawable-mdpi/ic_launcher.png
12 Realidoid/res/layout/main.xml
... ... @@ -0,0 +1,12 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="fill_parent"
  4 + android:layout_height="fill_parent"
  5 + android:orientation="vertical" >
  6 +
  7 + <TextView
  8 + android:layout_width="fill_parent"
  9 + android:layout_height="wrap_content"
  10 + android:text="@string/hello" />
  11 +
  12 +</LinearLayout>
7 Realidoid/res/values/strings.xml
... ... @@ -0,0 +1,7 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 + <string name="hello">Hello World, WikitudeTesteActivity!</string>
  4 + <string name="app_name">Realidoid</string>
  5 + <string name="application_key">{your_application_key_here}</string>
  6 + <string name="developer_name">{your_developername_here}</string>
  7 +</resources>
92 Realidoid/src/br/com/androidnarede/realidoid/RealidoidActivity.java
... ... @@ -0,0 +1,92 @@
  1 +package br.com.androidnarede.realidoid;
  2 +
  3 +import java.io.IOException;
  4 +import java.util.ArrayList;
  5 +import java.util.List;
  6 +
  7 +import org.openintents.intents.WikitudeARIntent;
  8 +import org.openintents.intents.WikitudePOI;
  9 +
  10 +import wikitude.teste.R;
  11 +
  12 +import android.app.Activity;
  13 +import android.content.Context;
  14 +import android.location.Address;
  15 +import android.location.Geocoder;
  16 +import android.location.Location;
  17 +import android.location.LocationManager;
  18 +import android.os.Bundle;
  19 +import android.widget.Toast;
  20 +
  21 +/**
  22 + * Aplica��o apresentada durante o
  23 + * AndroidConf Brasil 2011, que demonstra
  24 + * como integrar a Wikitude API em Android
  25 + * para criar uma aplica��es com realidade
  26 + * aumentada.
  27 + *
  28 + * @author ramonrabello
  29 + * @since 26 de Novembro de 2011
  30 + */
  31 +public class RealidoidActivity extends Activity {
  32 +
  33 + private WikitudeARIntent wikitudeIntent;
  34 + private List<WikitudePOI> pontosDeInteresse;
  35 +
  36 + // infos de localiza��o
  37 + private Location location;
  38 + private LocationManager locationManager;
  39 + private Double latitude;
  40 + private Double longitude;
  41 + private Double altitude;
  42 +
  43 + @Override
  44 + public void onCreate(Bundle savedInstanceState) {
  45 + super.onCreate(savedInstanceState);
  46 + setContentView(R.layout.main);
  47 + pontosDeInteresse = new ArrayList<WikitudePOI>();
  48 + locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  49 + location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
  50 +
  51 + // se o GPS estiver ativo, captura a localizacao do aparelho,
  52 + // caso contr�rio, simula uma localiza��o
  53 + if (location != null){
  54 + latitude = location.getLatitude();
  55 + longitude = location.getLongitude();
  56 + altitude = location.getAltitude();
  57 + } else {
  58 + // simulando as coordenadas
  59 + latitude = -1.274309;
  60 + longitude = -48.501892;
  61 + altitude = location.getAltitude();
  62 + }
  63 +
  64 + wikitudeIntent = new WikitudeARIntent(getApplication(),
  65 + getResources().getString(R.string.application_key),
  66 + getResources().getString(R.string.developer_name));
  67 + wikitudeIntent.addTitleText("Android na Rede");
  68 +
  69 + Geocoder geocoder = new Geocoder(this);
  70 +
  71 + try {
  72 +
  73 + // recupera as ocorr�ncias dos endere�os de acordo com a latitude e longitude do aparelho
  74 + List<Address> enderecos = geocoder.getFromLocation(latitude,
  75 + longitude, 10);
  76 +
  77 + for (Address endereco : enderecos) {
  78 + WikitudePOI wikitudePoi = new WikitudePOI( latitude,
  79 + longitude,
  80 + altitude,
  81 + endereco.getFeatureName(),
  82 + endereco.getFeatureName() + ", " +
  83 + endereco.getCountryName() + " - " + endereco.getPostalCode() + "(" + endereco.getPhone() + ")");
  84 + pontosDeInteresse.add(wikitudePoi);
  85 + }
  86 + wikitudeIntent.addPOIs(pontosDeInteresse);
  87 + } catch (IOException e) {
  88 + Toast.makeText(this, "Erro ao obter localiza��o!", Toast.LENGTH_LONG).show();
  89 + }
  90 + wikitudeIntent.startIntent(this);
  91 + }
  92 +}

0 comments on commit a2a6321

Please sign in to comment.
Something went wrong with that request. Please try again.