• This repository has been archived on 30/Jul/2020
  • Stars
    star
    148
  • Rank 248,886 (Top 5 %)
  • Language
    C#
  • License
    zlib License
  • Created almost 12 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Social Connector

Social Connector v0.5.0

Android/iOSで、様々なアプリと連携を行いゲームスコアなどをシェアするプラグイン。

注意:

  • Facebookはプライバシーポリシーにより事前のテキスト挿入を許可していないのでテキストの共有はできません。 https://developers.facebook.com/docs/apps/review/prefill
  • このプラグインでは LINE は 画像(+テキスト)のみ共有できます。テキストのみはできません。(ただし LINE Keepは可能)
  • AndroidはFileProviderに対応しなければいけません。詳細はFileProviderに対応するを参照してください。

Requirements

iOS

  • iOS8.2+

Android

  • Android 2.3+

使い方

SocialConnector.Share("Social Connector", "https://github.com/anchan828/social-connector", imagePath);

サンプル

See Assets/Plugins/SocialConnector/Sample/Sample.cs

using UnityEngine;

namespace SocialConnector
{
	public class Sample : MonoBehaviour
	{
		string imagePath {
			get {
				return Application.persistentDataPath + "/image.png";
			}
		}

		void OnGUI ()
		{

			if (GUILayout.Button ("<size=30><b>Take</b></size>", GUILayout.Height (60))) {
				Application.CaptureScreenshot ("image.png");
			}

			GUILayout.Space (60);

			///=================
			/// Share
			///=================

			if (GUILayout.Button ("<size=30><b>Share</b></size>", GUILayout.Height (60))) {
				SocialConnector.Share ("Social Connector", "https://github.com/anchan828/social-connector", null);
			}
			if (GUILayout.Button ("<size=30><b>Share Image</b></size>", GUILayout.Height (60))) {
				SocialConnector.Share ("Social Connector", "https://github.com/anchan828/social-connector", imagePath);
			}
		}
	}
}

FileProviderに対応する

Android API Level 24 から、画像のシェアにおいて FileProvider の使用が必須となりました。このため、プロジェクト単位で AndroidManifest.xml をカスタマイズしなければいけません。

Social Connectorが用意したAndroidManifest.xmlを使用する

実装例としてSocialConnector/Plugins/Androidフォルダー配下にAndroidManifest.xmlを配置しています。 以下の手順に沿うことで、FileProviderに対応することが可能です。

  1. SocialConnector/Plugins/AndroidフォルダーをPlugins/Androidフォルダーに移動する
  2. AndroidManifest.xml内のcom.kyusyukeigo.socialconnector.fileproviderをプロジェクトのパッケージ名に書き換える。(例: パッケージ名がcom.example.gameであれば com.example.game.fileproviderに書き換える)
    • パッケージ名は、Player SettingsのIdentificationApplication.identifierで確認することができます。

トラブルシューティング

もし、何かしらのエラーが起きた場合 support-core-utils-25.3.1.aar を削除してみてください。ライブラリの競合が解決し、ビルドが通るかもしれません。

Advanced

  • iOS
    • 画像を端末に保存するときにプライバシーアクセス - NSPhotoLibraryUsageDescription が必要です。プラグイン側で自動的に追加していますが、使用目的の説明文が英語で記載されています(Save the Application's screenchot. という文)。もし日本語で表示したい場合は Localizable.strings を追加してください。ja.lproj/InfoPlist.stringsに以下のように追加すれば大丈夫なはず。

技術的なお話

このプラグインは、次の技術を使用しています。

  • Android: ACTION_SEND
  • iOS: UIActivityViewController

ACTION_SENDUIActivityViewController は不特定多数のアプリに対してシェアを行うための機能です。特定のアプリに対してのシェアをサポートしているわけではないということに注意してください。

更新履歴

v0.5.0

v0.4.1

  • [iOS] 画像を保存するときのために NSPhotoLibraryUsageDescription を追加

v0.4.0

  • [iOS] UIActivityViewController が日本語で表示されていなかった問題を解決
  • [iOS] 通常の機能でシェアができるようになったため、LINEのインテグレーションを削除
  • SocialConnectorの名前空間を追加

ライセンス

Copyright (C) 2011 Keigo Ando

This software is provided 'as-is', without any express or implied
warranty.  In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
   claim that you wrote the original software. If you use this software
   in a product, an acknowledgment in the product documentation would be
   appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
   misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

More Repositories

1

property-drawer-collection

カスタムプロパティの作品集
C#
258
star
2

typeorm-helpers

TypeScript
79
star
3

unitejapan2014

C#
65
star
4

unity-snippets

62
star
5

unity-GameViewSizeHelper

ScriptからGameViewSizeを作成、また設定するヘルパークラス
C#
54
star
6

ReferenceViewer

Unity5対応する予定
C#
44
star
7

unity-editor-book-example

エディタ拡張本のサンプル置き場
C#
43
star
8

monodevelop-code-template-unity

Move to https://github.com/anchan828/unity-snippets
37
star
9

unity-network-sample

Unityのネットワークサンプルを簡略化したもの
C#
36
star
10

nest-cloud-run-queue

Create a Queue/Worker for NestJS application in Cloud Run.
TypeScript
31
star
11

nest-sendgrid

TypeScript
29
star
12

unity-notification

iOSとAndroidの通知に関するプラグイン
C#
24
star
13

nest-bull

TypeScript
24
star
14

deploygate-with-unity

UnityでDeployGateを使うためのアセット
C#
21
star
15

nest-redlock

TypeScript
17
star
16

sprite-animation-preview

C#
16
star
17

texture-tree-view-sample

C#
14
star
18

unity-ReorderableList

C#
13
star
19

unite2015tokyo

C#
13
star
20

namecreator

C#
12
star
21

nest-i18n

i18n packages for NestJS
TypeScript
10
star
22

custom-asset

Make custom editor for unsupported assets.
C#
9
star
23

ScriptTemplates

5
star
24

twitter-in-unity-webplayer

Unity内で完結させたもの
C#
5
star
25

techhills-unity

C#
5
star
26

nest-cache-dependency

A cache dependency module for Nest framework (node.js)
TypeScript
4
star
27

unity-applescript

C#
4
star
28

StateMachineMaker

RuntimeでもStateMachineをScriptからアクセスできるように
C#
4
star
29

Unity-MultiBuilder

複数のプラットフォームを同時にビルド
C#
4
star
30

nest-lerna-template

Template repository for nestjs monorepo (using lerna)
JavaScript
4
star
31

unity-dll-creator

Module ManagerのためのDLL作成ツール
JavaScript
3
star
32

nest-commands

Build command line tools with Nestjs
TypeScript
3
star
33

OmnisharpForUnity

C#
3
star
34

PrefabExtension

Prefabを使いやすく?
C#
3
star
35

nest-kysely

TypeScript
3
star
36

nest-cache

TypeScript
2
star
37

gen-graphql-schema

TypeScript
2
star
38

nest-storage

TypeScript
2
star
39

unity-book-textlint

JavaScript
2
star
40

ChangeEditorFonts

Unityエディタのフォントを変更する
C#
2
star
41

UnityConfig

C#
2
star
42

editor-manual

JavaScript
2
star
43

YokohamaTamaOtoshi

懇親会で話したやつ
1
star
44

file-place

ファイル置き場
1
star
45

HelloGit

はじめの一歩
JavaScript
1
star
46

unity-3.5b-test

適当に触りの部分だけ
C#
1
star
47

unity-handbell-jyoya

ハンドベルアプリ除夜の鐘バージョン
C#
1
star
48

unity-nodeninja

1
star
49

anchan828

1
star
50

unity-node

JavaScript
1
star
51

ComponentOrderAttribute

C#
1
star
52

textlint-packages

TypeScript
1
star
53

hexo-theme-unity

JavaScript
1
star
54

4jSample

Androidでついったあ
Java
1
star
55

nest-swc-test

TypeScript
1
star
56

first-step-stattemchine

自作ステートマシンを作る最初の一歩
C#
1
star
57

nest-bull-example

TypeScript
1
star
58

UGJ-Chat-System

一人UGJで作成したもの
ASP
1
star
59

nest-cloud-run-pubsub-demo

TypeScript
1
star