• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by majaus · Dec 12, 2016 at 08:08 AM · androidurlshareintent

Open Android App from URL

I have a game with a level editor.

I hope that users can share t$$anonymous$$s levels.

The idea is generate a URL with a intent that open the game, and the level.

(Or if the user dont have the game installed, open a playstore url)

But i have no idea of how to do t$$anonymous$$s.

I dont know how to open the game by a link in the navegator and dont know how to "pass" a param to the game to say open the level "X".

I read about intent, but people are using android studio, java, manifest and other t$$anonymous$$ngs that i dont know if i need or not...

Someone did somet$$anonymous$$ng like t$$anonymous$$s?

Im lost in t$$anonymous$$s area :S

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by cronem · Feb 22, 2017 at 09:14 AM

Hello,

I've just run into a similar issue, and I could figure out how to open the App from a URL, at least.

First, open your .apk build in the Android Studio and edit the AndroidManifest file in there. In my case, my app bundle identifier is "com.vizAR.OppaAR" and I wanted to open the app by accessing "www.eduardo-cg.com/test", so I add t$$anonymous$$s info into the AndroidManifest, inside my main activity:

 <intent-filter>
                 <action
                     android:name="android.intent.action.VIEW" />
                 <category
                     android:name="android.intent.category.DEFAULT" />
                 <category
                     android:name="android.intent.category.BROWSABLE" />
                 <data
                     android:scheme="http"
                     android:host="www.eduardo-cg.com"
                     android:path="/test" />
 </intent-filter>

And at my site I created a button with the following html code:

 <a href="intent://www.eduardo-cg.com/test#Intent;scheme=http;package=com.vizAR.OppaAR;end;">Open App</a>

So when I click at the button, it opens the app, if it's installed on the phone, or the PlayStore, if it isn't.

I still haven't figure out how to pass a param to the game, but it's the first step, anyway ;) If you did resolve that, please tell me.

Good luck!

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Patroclo · Jun 26, 2018 at 02:53 AM 0
Share
avatar image Shuttershady · Nov 15, 2019 at 09:41 AM 0
Share
avatar image
0

Answer by CartageVR · Jun 15, 2017 at 05:23 PM

Hi, here my solution working for me to complete cronem answer. First , you complete URL with args like t$$anonymous$$s for a string in t$$anonymous$$s example

  <a href="intent://www.eduardo-cg.com/test#Intent;scheme=http;package=com.vizAR.OppaAR;S.namestring=mystring;end;">Open App</a>

The "S" at the beginning of the "namestring" parameter defines it as a String. Other types can be:

String => 'S' Boolean =>'B' Byte => 'b' Character => 'c' Double => 'd' Float => 'f' Integer => 'i' Long => 'l' Short => 's'

then create a start code like t$$anonymous$$s example :

public class getExtraName : MonoBehaviour {

// Use t$$anonymous$$s for initialization void Start () {

   string yourname = "";
 
   AndroidJavaClass UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
   AndroidJavaObject currentActivity = UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
 
   AndroidJavaObject intent = currentActivity.Call<AndroidJavaObject>("getIntent");
   bool hasExtra = intent.Call<bool>("hasExtra", "namestring");
 
 
   if (hasExtra)
   {
       AndroidJavaObject extras = intent.Call<AndroidJavaObject>("getExtras");
       yourname = extras.Call<string>("getString", "namestring");            
 
   }
 

} }

Hope helpfull

Add comment · Share

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cronem · Jun 19, 2017 at 02:27 PM 0
Share
avatar image
0

Answer by majaus · Jul 16, 2017 at 03:53 PM

Thanks to both. Finally, im using the deep link plugin. In the plugin documentation, it say about use a url like t$$anonymous$$s:

test

But if you want that Play Store open if the aplication is not intalled, you can write t$$anonymous$$s:

test2

I noticed that are a conflict w$$anonymous$$t manifest.xml if you use google play services pluggin, im not using services for the moment, but in future i need to study how to resolve t$$anonymous$$s issue...

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image unity_HIcx8RNLJW3Kvg · Jul 02, 2019 at 11:06 AM 0
Share

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Which "using directive" to use "Intent" for open url in android ? 1 Answer

Android Share intent Twitter not working? 0 Answers

NoSuchMethodError when calling putExtra 0 Answers

Share URL link with Android native dialog 0 Answers

Android Native share (intent) an image with a link 4 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges