Skip to content

Commit

Permalink
Fix share screenshots for Android >= 8.0 Oreo
Browse files Browse the repository at this point in the history
  • Loading branch information
modos189 committed Apr 21, 2019
1 parent 6677855 commit 5a38aab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions mobile/app/src/main/AndroidManifest.xml
Expand Up @@ -155,6 +155,16 @@
android:noHistory="false"
android:theme="@android:style/Theme.Holo.Dialog"/>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>

<!-- START Used for Samsung Multi-Window support -->
<uses-library
android:name="com.sec.android.app.multiwindow"
Expand Down
Expand Up @@ -11,9 +11,11 @@
import android.view.MenuItem;

import androidx.core.app.NavUtils;
import androidx.core.content.FileProvider;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager.widget.ViewPager;

import org.exarhteam.iitc_mobile.BuildConfig;
import org.exarhteam.iitc_mobile.Log;
import org.exarhteam.iitc_mobile.R;

Expand All @@ -31,7 +33,8 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
public static Intent forFile(final Context context, final File file, final String type) {
return new Intent(context, ShareActivity.class)
.putExtra(EXTRA_TYPE, TYPE_FILE)
.putExtra("uri", Uri.fromFile(file))
.putExtra("uri", FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider",file))
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
.putExtra("type", type);
}

Expand Down

0 comments on commit 5a38aab

Please sign in to comment.