Pass cookie to browser via Intent

前端 未结 3 1685
没有蜡笔的小新
没有蜡笔的小新 2021-02-06 00:30

I have saved a cookie in android. Now I want to pass it into my browser intent. Look at my current code:

Intent browser = new Intent(\"android.intent.action.VIEW         


        
3条回答
  •  盖世英雄少女心
    2021-02-06 01:09

    Here is the answer that uses android.proveder.Browser:

    I have a Map object that I stored the header information I want to pass. Then the following:

    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    Bundle bundle = new Bundle();
    if(mExtraHeader!=null){
     for(String key: mExtraHeader.keySet()){
      bundle.putString(key, mExtraHeader.get(key));
     }
    }
    i.putExtra(Browser.EXTRA_HEADERS, bundle);
    startActivity(i);
    

    Like the other guy mentioned, this would only work with the default browser and other browsers wouldn't have Browser.EXTRA_HEADERS I suppose. Resource: http://gitorious.org/rowboat/packages-apps-browser/blobs/a563d09392905140893d7a017dd63721577e1953/src/com/android/browser/BrowserActivity.java

提交回复
热议问题