Chinaunix首页 | 论坛 | 博客
  • 博客访问: 177416
  • 博文数量: 57
  • 博客积分: 719
  • 博客等级: 上士
  • 技术积分: 320
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-25 17:15
文章分类

全部博文(57)

文章存档

2014年(1)

2013年(18)

2012年(9)

2011年(22)

2010年(7)

分类:

2011-08-27 00:20:39

  描述:

  创建一个自己的应用程序
  查找你想替换的系统默认应用程序的XML文件(怎样从应用程序的APK文件里获得XML文件请参考http://devtcg.blogspot.com/2008/ ... nary-xml-files.html)
由于我们想替换系统默认的地图应用程序,于是我们就在/android-system-apks/Maps/AndroidManifest.xml  里查找关键字“Maps”,通过这样我们就找到了系统默认程序的intent-filter里的内容

         XML:

     xmlns:android=""
     android:sharedUserId="com.google.android.core"
     android:signature="com.google"
     package="com.google.android.maps">
     
               android:label="@string/read_perm_label"
          android:name="com.google.android.maps.permission.READ_MY_MAPS"
          android:description="@string/read_perm_desc" />
     ....
    
     ....
     
               android:theme="@android:style/Theme.Dark"
          android:icon="@drawable/ic_launcher_maps"
          android:taskAffinity="com.google.android.maps">
          
                         android:label="@string/maps_label"
               android:name="Maps"
               android:launchMode="singleTop">
                    ....
              



              ....
         
     ....
    

  打开自己应用程序的 AndroidManifest.xml 文件,像下面这样添加自己程序想监听的内容(当然是和系统默认程序监听的内容一样啊):
         XML:
        ...
       
         
              
              
              
              
         

       

        ...
 

  运行一次自己的程序,然后关闭它(仅仅是为了把它在模拟器里安装上).
  下一次当含有"geo"-uri scheme的intent广播的时候,我们的程序就会启动
这时系统会问你要使用两个可用程序 里的哪一个来响应关于"geo"-scheme的VIEW-Action 。
   第一个 就是 系统默认的应用程序
  第二个 就应该是你自己的应用程序了
测试的时候使用另外一个程序来执行下面这行代码:
         Java:
startActivity(new Intent(android.content.Intent.VIEW_ACTION, Uri.parse("geo:49.473367,8.660274")));

阅读(900) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~