Closed5

[Flutter] social_shareの使い方

わかなおわかなお

social_shareとは

特定の人気のアプリに直接共有できるもの。InstagramやTwitterなどにシェアできる。
social_share

わかなおわかなお

使い方

Android
・android/app/src/main/AndroidManifest.xml に以下を追加

`xmlns:tools="http://schemas.android.com/tools"`

こんな感じで追加

        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                package="your package...">

・さらにandroid/app/src/main/AndroidManifest.xmlのmanifest/applicationに以下を追加

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

・app/src/main/res/xmlフォルダを作成し、filepaths.xmlを作って以下をコピペ

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <cache-path name="image" path="/"/>
</paths>

こんな感じ

わかなおわかなお

使い方 iOS

instagram,twitterを使う場合。
whatappはなんだろ
・Info.plistに以下を追加

<key>LSApplicationQueriesSchemes</key>
	<array>
	<string>instagram-stories</string>
	<string>instagram</string>
	<string>twitter</string>
	<string>whatsapp</string>
    <string>tg</string>
	</array>

これでおけ?

わかなおわかなお

エラーが出てできなかった。ネイティブ周りをどうにかしなきゃいけないかも

このスクラップは2023/08/21にクローズされました