Skip to content

Instantly share code, notes, and snippets.

View agrawalsuneet's full-sized avatar
🎲
Busy building games

Suneet Agrawal agrawalsuneet

🎲
Busy building games
View GitHub Profile
@agrawalsuneet
agrawalsuneet / NativeAndroidTextSharingInUnity.cs
Last active May 5, 2024 01:03
Native Android text Share in Unity
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class NativeAndroidTextSharingInUnity : MonoBehaviour {
public Button shareButton;
private bool isFocus = false;
private bool isProcessing = false;
@agrawalsuneet
agrawalsuneet / NativeAndroidScreenshotSharingInUnity.cs
Last active October 30, 2019 15:41
Native Android screenshot sharing in Unity
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class NativeAndroidScreenshotSharingInUnity : MonoBehaviour {
public Button shareButton;
private bool isFocus = false;
@agrawalsuneet
agrawalsuneet / NativeAndroidTextShareToParticularApp.cs
Last active November 15, 2019 15:18
Native Android text Share to particular app in Unity
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class NativeAndroidTextShareToParticularApp : MonoBehaviour {
public Button shareButton;
private bool isFocus = false;
private bool isProcessing = false;
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class NativeScreenshotShareUsingFileProvider : MonoBehaviour
{
public Button shareButton;
private bool isFocus = false;
using UnityEngine.UI;
using UnityEngine;
public class NativeAndroidInUnity : MonoBehaviour
{
public Button showToastButton;
public string toastText = "This is a Toast";
void Start()
{
package com.agrawalsuneet.gist
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
object ShareTextToWhatsappContact {
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class NativeAndroidWhatsappContactDirectShare : MonoBehaviour {
public Button shareButton;
private string packageName = "com.whatsapp";
//
// UIView+ClickListener.swift
//
// Created by Suneet Agrawal on 12/12/20.
//
import UIKit
// MARK: ClickListener
class ClickListener: UITapGestureRecognizer {
using UnityEngine;
public class CastToJavaObject : MonoBehaviour
{
//C# Code
public AndroidJavaObject castToJavaObject(AndroidJavaObject source, string className)
{
var clazz = new AndroidJavaClass("java.lang.Class");
var destClass = clazz.CallStatic<AndroidJavaObject>("forName", className);
return destClass.Call<AndroidJavaObject>("cast", source);