android点击链接启动应用

首先要在Androidmanifest.xml ,在闪屏的activity写上这样的配置

 

[html][/html] view plaincopyprint?

  1. <activity
  2.             android:name=”cn.safetrip.edog.SplashScreenActivity”
  3.             android:screenOrientation=”portrait”
  4.             android:theme=”@android:style/Theme.Translucent.NoTitleBar” >
  5.             <intent-filter>
  6.                 <action android:name=”android.intent.action.MAIN” />
  7.                 <category android:name=”android.intent.category.LAUNCHER” />
  8.                  </intent-filter>
  9.                 <intent-filter>
  10.                 <category android:name=”android.intent.category.BROWSABLE”/>
  11.                  <action android:name=”android.intent.action.VIEW”/>
  12.                   <category android:name=”android.intent.category.DEFAULT”/>
  13.                 <data
  14.                         android:host=”vendor”
  15.                         android:scheme=”autopia”/>
  16.            </intent-filter>
  17.         </activity>

接着就要在自己的闪屏activity类中的onresume()方法中写下如下代码:

 

 

 

[java][/java] view plaincopyprint?

  1.              name = getIntent().getDataString();
  2. f (name != null && name.contains(“autopia”)) {
  3. goHome();

goHome方法用来跳转到其他的Activity:

 

 

[java][/java] view plaincopyprint?

  1. private void goHome(Boolean isfromurl) {
  2.         Intent intent = intent = new Intent(SplashScreenActivity.this,
  3.                     MapMainActivity.class);
  4.         putPickUpData(intent);
  5.         startActivity(intent);
  6.         finish();
  7.     }


putPickUpData方法用来解析url数据,这个根据不同的需求有不同的处理,在这里就不说了

标签