Android Ultimate Plugin new way of Screen Shot and Sharing Image and URL

Hi Guys, there’s a lot of changes since we 1st release Android Ultimate Plugin and one of those changes is we made a way¬† to separate bundle plugin into a single plugins reason is to make it more optimize and use only what you are really want to used and today we will show you on how to screen shot and share image or URL.

If you read our old post about sharing images and URL we use the same Android Manifest Permissions. so you don’t need to change that, but make sure you have those permissions and of course the Android Manifest it self.

Permission needed on your Android Manifest file without this it will not work or it will produce an error.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>  
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

 

And Here’s the new way of screenshot and sharing images and url

First you need to have the instance of SharePlugin

private SharePlugin sharePlugin =SharePlugin.GetInstance();

Then we need to pass 0 to SetDebug to remove Debug toast messages

sharePlugin.SetDebug(0);

Then to Screen shot and share images just do this

public void ShareImage(){      
        string screenShotName = "AUPScreenShot.jpg";
        string folderPath = utilsPlugin.CreateFolder("MyScreenShots",0);
        string path ="";

        if(!folderPath.Equals("",StringComparison.Ordinal)){
            path = folderPath + "/" + screenShotName;

            //note: we added new required variable to pass which is screenShotName to determined what image format to use
            //jpg or png, if format is not given set default to jpg format
            StartCoroutine(AUP.Utils.TakeScreenshot(path,screenShotName));
            sharePlugin.ShareImage("subject","subjectContent",path);
        }
}

And to Share URL just do this

public void ShareText(){        
        //share link
        sharePlugin.ShareUrl("my subject","my subject content","https://www.urltoshare.com");
    }

 

And we are done, one thing that you will noticed here is we just change the Android Ultimate Plugin with SharePlugin and actually that’s the new thing that we did here and also noticed the new way on how we Take a screen shot

 

Here’s the actual code that we used on our demo

using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;

public class ShareAndExperienceDemo : MonoBehaviour {	

	private bool isImmersive = false;
	private SharePlugin sharePlugin;
	private UtilsPlugin utilsPlugin;

	// Use this for initialization
	void Start (){
		utilsPlugin = UtilsPlugin.GetInstance();
		utilsPlugin.SetDebug(0);

		sharePlugin = SharePlugin.GetInstance();
		sharePlugin.SetDebug(0);
	}

	public void ImmersiveToggle(){
		if(!isImmersive){
			utilsPlugin.ImmersiveOn(500);
			isImmersive = true;
		}else{
			utilsPlugin.ImmersiveOff();
			isImmersive = false;
		}
	}

	public void ShareText(){		
		//share link
		sharePlugin.ShareUrl("my subject","my subject content","https://www.urltoshare.com");
	}

	public void ShareImage(){

		//if you want to save on Application.persistentDataPath, file on this path is remove when app is uninstal
		//string screenShotName = "AndroidUltimateScreenShot.png";
		//string path = Application.persistentDataPath + "/" + screenShotName;

		string screenShotName = "AUPScreenShot.jpg";
		string folderPath = utilsPlugin.CreateFolder("MyScreenShots",0);
		string path ="";

		if(!folderPath.Equals("",StringComparison.Ordinal)){
			path = folderPath + "/" + screenShotName;

			//note: we added new required variable to pass which is screenShotName to determined what image format to use
			//jpg or png, if format is not given set default to jpg format
			StartCoroutine(AUP.Utils.TakeScreenshot(path,screenShotName));
			sharePlugin.ShareImage("subject","subjectContent",path);
		}
	}
}

 

I hope this short Tutorial helps you on how to take screenshot and share images and URL on the new version of Android Ultimate Plugin.

If you have questions or suggestions or any feedback just email us at gigadrillgames@gmail.com

Thank you for visiting and reading!

2 thoughts on “Android Ultimate Plugin new way of Screen Shot and Sharing Image and URL

  • June 22, 2016 at 11:40 am
    Permalink

    Hi I just purchased your plugin Android Ultimate but I cannot able to compile the errors. I’m using Unity 5.3.4f1 (32-bit) and Vuforia-unity-5-5-9.
    My AR is working good but when I tries to import your plugin then everything stops with compilation errors. I’m ready to send my test file. I just need Camera Snapshot with share. I already done the things you mentioned in your tutorial but no luck.

    Reply
    • July 13, 2016 at 3:27 am
      Permalink

      Hi can you email us gigadrillgames@gmail.com and send me your invoice id that you get when you bought the plugin from asset store and error logs that you have thanks

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.