华为推送 坑点 自定义intent

  现在   AndroidManifest.xml 配置  


 
 
<activity
    android:name="com.jbs.ui.activity.RemarkListActivity"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="stateVisible|adjustPan|adjustUnspecified|stateHidden" >
     <intent-filter>
         <action
             android:name="android.intent.action.VIEW"/>
         <category
             android:name="android.intent.category.DEFAULT"/>
         <data android:scheme="customscheme"
             android:host="com.huawei.pushtest"     //固定的
             android:path="/notify_remark" />

     </intent-filter>
</activity>




然后  生成 url


///获取intent url
		Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse("customscheme://com.huawei.pushtest/notify_remark?tittle=我是tille"));
		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		String intenturl=intent.toUri(Intent.URI_INTENT_SCHEME);

		Log.e("intenturl","intenturl="+intenturl);


客户端获取参数

String index = "";
		Uri uri = getIntent().getData();
		if (uri != null) {
			index = uri.getQueryParameter("param");
			if (first&&TextUtil.isEmpty(index)) {
				if (index.equals("1")) {
					if (first) {
						//execute the task
						Log.e("执行跳转");
						setGrabOrderSelect(); //跳转抢单 刷新
						first=false;
					}

				} else if (index.equals("2")) {
						Log.e("执行跳转");
						setOrderSelect(0); //跳转
						first=false;
				}
			}
		}



猜你喜欢

转载自blog.csdn.net/berlor/article/details/78040278