UC2POCKET solves the problem of sharing from UC to pocket

Source: Internet
Author: User
---------- 2014412 update ------------------- with the release of the new UC and Pocket Chinese versions, I don't know which Party has made the changes. In short, I can share the changes directly from UC to Pocket! Fast update Haha, this UC2Pocket has become a history and no longer provides updates and maintenance ------------------------------------

---------- 2014 4 12 update ------------------- with the release of the new UC and Pocket Chinese versions, I don't know which Party has made the changes. In short, I can share the changes directly from UC to Pocket! Fast update Haha, this UC2Pocket has become a history and no longer provides updates and maintenance ------------------------------------

---------- 2014 4 12 update ---------------------

With the release of the new version of UC and Pocket Chinese versions, I don't know which Party has made the changes. In short, I can share the changes directly from UC to Pocket! Fast update. Haha, this UC2Pocket has become a history and no longer provides updates and maintenance.

----------------------------------------------------------

I don't know when UC can no longer be shared to the pocket. As a heavy user of the pocket and uc, this cannot be tolerated.

It is possible that the intent sent by UC is not in line with the intent-filter of pocket, and UC2POCKET is used as an adapter.

First, attach the apk address, and take the desired kids shoes directly to the UC2POCKET Baidu disk.


Using apktools to decompile the Pocket file and obtain its key manifest. xml Code

               
                                
                  
              
         
This is the intent-filter that the pocket receives and shares.

So write it like this.

 Intent intent = new Intent(Intent.ACTION_SEND); intent.setClassName("com.pocket.cn","com.ideashower.readitlater.activity.AddActivity");//intent.putExtra(Intent.EXTRA_SUBJECT, midIntent.getStringExtra(Intent.EXTRA_SUBJECT));  String originUrl=midIntent.getStringExtra(Intent.EXTRA_TEXT);intent.putExtra(Intent.EXTRA_TEXT, getUrlFromUCShare(originUrl)); intent.setType("text/plain"); intent.addCategory(Intent.CATEGORY_DEFAULT);if(MainActivity.isIntentAvailable(MainActivity.this, intent)){MainActivity.this.startActivity(intent);                        }
While
intent.setClassName("com.pocket.cn","com.ideashower.readitlater.activity.AddActivity");
I got the package name from titanium backup. In fact, there are some Manifest files .. The activity name is the result of decompiling the Manifest. xml file. The name of AddActivity is concise and intuitive.

It is more convenient to receive the intent of UC, and the conditions are not harsh. I copied it directly from the filter of keep, and modified it later.

The extra-text obtained from UC is an address added to the webpage name. You need to extract the address. What happens if the mixed content is not verified?

public static String getUrlFromUCShare(String originStr){Pattern p=Pattern.compile("[a-zA-z]+://[^\\s]*"); Matcher matcher = p.matcher(originStr);        if (matcher.find()) {                String result= originStr.substring(matcher.start(), matcher.end());        return result;        }        else return null;}

In addition, a message indicating that the address is not a valid address is displayed when the pocket is shared. Later, it was found that http: // was required to be followed. If you share www.google.com directly instead of the http://www.google.com, then pocket will prompt a non-valid address... There's a similar problem http://stackoverflow.com/questions/16108356/share-to-pocket in stackoverflow, which should be the reason


Attaches a function that displays all the content of the bundle, which is used to test the intent content.

Bundle B = midIntent. getExtras (); Set
 
  
KeySet = B. keySet (); // obtain all keys, for (String Key: keySet) {// bundle. get (key); to obtain the corresponding value tvState. setText (tvState. getText () + key + ":" + midIntent. getStringExtra (key) + "\ n"); // start}
 



Attached Source code address in csdn code https://code.csdn.net/dashboard/index

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.