Android starts the APP in the browser, android browser app

Source: Internet
Author: User

Android starts the APP in the browser, android browser app


To start an APP in a browser, follow these steps:


Add intent-filter information to the ACTIVITY to be redirected:


<Intent-filter>
<Data android: scheme = "com. example. scheme"/>
</Intent-filter>


Example:
<Activity android: name = ". BrowActivity">
<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 = "com. example. scheme"/>
<Action android: name = "android. intent. action. VIEW"/>
</Intent-filter>
</Activity>
 
 
 
Add the following link in HTML: <a href = "my. special. scheme: // other/parameters/here">


After entering the APP, you can use getIntent () to obtain the information carried by the URL:


EG http://twitter.com/status/1234
Uri data = getIntent (). getData ();
String scheme = data. getScheme (); // "http"
String host = data. getHost (); // "twitter.com"
List <String> params = data. getPathSegments ();
String first = params. get (0); // "status"
String second = params. get (1); // "1234"
How does android enable automatic Service or app startup?

The Android mobile phone will trigger a Standard Broadcast Action during startup, called android. intent. action. BOOT_COMPLETED (remember to trigger only once). Here we can build a broadcast receiver to receive this action. next I will briefly write the following implementation steps: 2. step 1: Create a broadcast receiver and reconstruct its abstract method onReceive (Context context, Intent intent) to start the Service or app you want to start. Import android. content. broadcastReceiver; import android. content. context; import android. content. intent; import android. util. log; public class BootBroadcastReceiver extends BroadcastReceiver {// rewrite the onReceive method @ Override public void onReceive (Context context, Intent intent) {// XXX. class is the service Intent service to be started = new Intent (context, XXXclass); context. startService (service); Log. v ("TAG", "auto start ..... "); // Start the application. The parameter is the package name Intent intent = getPackageManager () of the application to be automatically started (). getLaunchIntentForPackage (packageName); context. startActivity (intent) ;}} Step 2: configure the xml file and add the intent-filter configuration to the receiver android: name = "BootBroadcastReceiver"> <intent-filter> <action android: name = "android. intent. action. BOOT_COMPLETED "> </action> <category android: name =" android. intent. category. LAUNCHER "/> </intent-filter> </Explorer> Step 3: add permissions <uses-permission android: name = "android. permission. RECEIVE_BOOT_COMPLETED "/> Start the APP: As a hotkey project, there are several shortcut keys that need to start the browser and email that comes with the system. Because I just started to learn about android, I found the method to start browser and email on the Internet, using intent such as ACTION_VIEW and SENDTO to start browser and email. question: 1. in this case, you need to preset a URL to start the browser, and then call the browser to open and modify the URL. 2. Start email. You also need to set your own account address... the remaining full text>

Create an APP on the Android mobile phone and open the URLs between companies in the form of a browser. Ask what controls are used in the navigation bar below?

You can use View to write one, and then add the buttons one by one on it!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.