Search Unity

[RELEASED] Share Target for Android - Receive Data from other apps

Discussion in 'Assets and Asset Store' started by ImaginationOverflowPT, Aug 25, 2020.

  1. ImaginationOverflowPT

    ImaginationOverflowPT

    Joined:
    Sep 15, 2017
    Posts:
    186
    Share Target for Android is a Unity plugin that allows your app to be the target of content shared by users on Android devices. The plugin automatically updates the android manifest with your desired configuration and its API consists on a single event registration.

    When your app/game is activated the plugin provides all information and easy access to all content that was shared.

    Under the hood, the plugin was made to ensure that it doesn't conflict with any other plugins.

    Features:
    - Plug and play
    - Built-in editor test tool
    - Simple API
    - Support from Unity 5.5 to the latest version

    The pro package includes the plugin source code, while the regular package is DLL only plugin.​

    Any feedback, issues, or comments feel free to do them on this thread or reach out directly to us over at Discord, Twitter, or Mail.
     
    Last edited: Aug 25, 2020
  2. unity_cic-PNqQMQ9LKA

    unity_cic-PNqQMQ9LKA

    Joined:
    Oct 30, 2020
    Posts:
    6
    Hello, tried out the asset, works really great! I already placed the plugin in a small app of mine. I have a question on the share function regarding the initiation of the app which is shared to. When I want to share a link from a website to my app, it can only be registered by my app when it is already open, i.e. if it is shut down, and the share operation opens it up on the first share, the link to be shared is not received. However, in the demo app it works just like that, i.e. the shared content is received even after launching the app on first share. What's the trick?
     
  3. ImaginationOverflowPT

    ImaginationOverflowPT

    Joined:
    Sep 15, 2017
    Posts:
    186
    Hi,
    Thanks for using one of our plugins!

    I would say that your problem is that you aren't registering a handler for the
    Code (CSharp):
    1. ShareTargetManager.Instance.ShareActivated
    event, from the top of my head that is the only reason I can see for it not to work on a cold launch since we also cache the share activations.

    Where are you registering your ShareActivated handler?
     
  4. unity_cic-PNqQMQ9LKA

    unity_cic-PNqQMQ9LKA

    Joined:
    Oct 30, 2020
    Posts:
    6
    Hi, thanks for the quick response! I am registering the handler in an Awake call, just as according to the Demo scene. I already thought of that the problem might be that the handler is not registered correctly upon app launch, not sure what I am doing differently from your code. When the app is closed, and a link is shared (which launches the app for the first time), the link is cached somewhere, until the ShareTargetManager.Instance.ShareActivated event is invoked with the link?

    Code (CSharp):
    1. using System.IO;
    2. using System.Runtime;
    3. using System.Text;
    4. using ImaginationOverflow.ShareTarget.Android;
    5. using ImaginationOverflow.ShareTarget.Data;
    6. using UnityEngine;
    7.  
    8. namespace ImaginationOverflow.ShareTarget.Demo
    9. {      
    10.     public class RemYTShareTarget : MonoBehaviour      
    11.     {
    12.         [SerializeField]
    13.         SendURL sendURL;
    14.  
    15.         public void Awake()
    16.         {
    17.             ShareTargetManager.Instance.ShareActivated += ShareActivated;
    18.         }
     
  5. ImaginationOverflowPT

    ImaginationOverflowPT

    Joined:
    Sep 15, 2017
    Posts:
    186
    Yes, we do cache the share activation.
    Is the object where the script is attached too, present for the entire scene?
    Can you send us a log of one boot with share that doesn't work (there is also a chance that other plugin is messing with our access)
     
  6. unity_cic-PNqQMQ9LKA

    unity_cic-PNqQMQ9LKA

    Joined:
    Oct 30, 2020
    Posts:
    6
    Ok, so I checked the Android logcat, turns out the ShareActivated event was working on a cold boot all along. The error ocurred due to an uninitialized class called in an OnShareActivated method. Sorry guys, my bad. Thanks for the feedback anyway, at least I learned to debug an Android phone better :)
     
  7. ImaginationOverflowPT

    ImaginationOverflowPT

    Joined:
    Sep 15, 2017
    Posts:
    186
    Glad it worked fine!

    If you can don't forget to give us a review on the asset store xD

    Let us know if you have any more questions or issues ;)
     
  8. unity_cic-PNqQMQ9LKA

    unity_cic-PNqQMQ9LKA

    Joined:
    Oct 30, 2020
    Posts:
    6
    Will do, 5 star review on the way ;)! Great asset and great support :), thanks again
     
    ImaginationOverflowPT likes this.
  9. ImaginationOverflowPT

    ImaginationOverflowPT

    Joined:
    Sep 15, 2017
    Posts:
    186
    Thanks ;)
    Anything else that we can help let us know