2015-05-11 60 views
0

我不斷收到一個谷歌+未安裝錯誤,當我嘗試併發布圖像到googleplus與plusshare.builder。 爲什麼只有當我嘗試發佈圖片時才能找到該活動? 發佈文字和內容網址可以正常工作,並可以通過Google +發佈。谷歌加圖像上傳後拋ActivityNotFoundException與圖像Uri

我的活動:

  String gPlusSmallUrl = intent.getStringExtra("gPlusCropUrl"); 
     String statusString = intent.getStringExtra("statusString"); 
      ContentResolver cr = this.getContentResolver(); 
      String mime = cr.getType(googleUri); 

      Intent shareIntent = new PlusShare.Builder(this) 
        //.setType("text/plain") //posting with this works 
        .setText("example text here")// posting with this works 
        .addStream(googleUri) //when i try to add an image it gives me a google+ not installed error 
        .setType(mime)// this is part of the failure too! 
        //.setContentUrl(Uri.parse(gPlusSmallUrl))//Posting with this also works fine. 
        .getIntent(); 
try { 
       startActivityForResult(shareIntent, 0); 
      } catch (ActivityNotFoundException e) { 
       Toast.makeText(this, "You haven't installed google+ on your device", Toast.LENGTH_SHORT).show(); 
      } 
      Log.i(TAG, "Posted to GooglePlus"); 

     } 
     GooglePlusActivity.this.setResult(GOOGLE_LOGIN_RESULT_CODE_SUCCESS); 
     finish(); 
    } 

清單: 權限:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 
    <uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
    <uses-permission android:name="android.permission.USE_CREDENTIALS" /> 
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 
    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /> 
    <uses-permission android:name="android.permission.READ_PROFILE" /> 

<meta-data 
      android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version" /> 

<activity 
      android:name=".GooglePlusActivity" 
      android:label="@string/title_activity_google_plus" > 
     </activity> 
     <intent-filter> 
      <action android:name="android.intent.action.SEND" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 

我想不通爲什麼添加圖像烏里將使扔ActivityNotFoundException

回答

-1

你應該嘗試.setstream代替.addstream 也試試只是圖片/ *類型