Launch custom android application from android browser

后端 未结 16 1148
一个人的身影
一个人的身影 2020-11-21 06:02

Can anybody please guide me regarding how to launch my android application from the android browser?

相关标签:
16条回答
  • 2020-11-21 06:57

    Please note if your icon is disappear from android launcher when you implement this feature, than you have to split intent-filter.

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <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="your-own-uri" />
            </intent-filter>
        </activity>
    
    0 讨论(0)
  • 2020-11-21 06:57

    Look @JRuns answer in here. The idea is to create html with your custom scheme and upload it somewhere. Then if you click on your custom link on your html-file, you will be redirected to your app. I used this article for android. But dont forget to set full name Name = "MyApp.Mobile.Droid.MainActivity" attribute to your target activity.

    0 讨论(0)
  • 2020-11-21 07:00

    example.php:

    <?php
    if(!isset($_GET['app_link'])){  ?>   
        <iframe src="example.php?app_link=YourApp://blabla" style="display:none;" scrolling="no" frameborder="0"></iframe>
        <iframe src="example.php?full_link=http://play.google.com/xyz" style="display:none;" scrolling="no" frameborder="0"></iframe>
        <?php 
    }
    else { ?>
        <script type="text/javascript">
        self.window.location        = '<?php echo $_GET['app_link'];?>';
        window.parent.location.href = '<?php echo $_GET['full_link'];?>';
        </script>
    <?php 
    }
    
    0 讨论(0)
  • 2020-11-21 07:01

    Hey I got the solution. I did not set the category as "Default". Also I was using the Main activity for the intent Data. Now i am using a different activity for the intent data. Thanks for the help. :)

    0 讨论(0)
提交回复
热议问题