Launching custom Android application from Android browser / Chrome
You need to set it up like this :
<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:host="example.com"
android:pathPrefix="/someresource/"
android:scheme="http" />
<data
android:host="www.example.com"
android:pathPrefix="/someresource/"
android:scheme="http" />
</intent-filter>
Notice that in your case, you would need to use android:pathPrefix instead of android:path.
Launch Android App from WEB browser
Guess I got my own answer after some more research:
It only works in Google Chrome but does the job in my case:
Links should look like:
<a href="intent://invoice/#Intent;scheme=company;package=company.printapp;S.doctype=FRA;S.docno=FRA1234;S.browser_fallback_url=http%3A%2F%2Fgoogle.com;end">PRINT INVOICE</a>
In the AndroidManifest.xml the important part is:
...
package="company.printapp"
...
<!-- Allow web apps to launch My App -->
<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="company" android:host="invoice" android:path="/"/>
</intent-filter>
And finally this is how I get the parameters I pass in the Intent link (doctype and docno):
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Bundle parametros = getIntent().getExtras();
if (parametros != null){
String Doctype = parametros.getString("doctype");
String DocNo = parametros.getString("docno");
TextView textView = (TextView) findViewById(R.id.DocNo);
textView.setText(DocNo);
BluetoothPrint(Doctype,DocNo);
}
}
Related Topics
Android: Android.Content.Res.Resources$Notfoundexception: String Resource Id #0X5
How to Solve the Install_Failed_Dexopt Error
Ndk Resolution Outcome: Project Settings: Gradle Model Version=5.4.1, Ndk Version Is Unknown Error
Send Data Back to the Script Which Started the Activity via Adb Shell Am Start
How to Use Adb in Android Studio to View an SQLite Db
Cursor Adapter and SQLite Example
Error Importing Holoeverywhere
How to Tell If the Sdcard Is Mounted in Android
Problem to Load Flv Video in Webview
Android - Volume Buttons Used in My Application
Emulator in Android Studio Doesn't Start
Camera Activity Returning Null Android
Ics Android Enable Gps Programmatically
How to Manipulate the Camera Preview
Error:(26, 0) Gradle Dsl Method Not Found: 'Runproguard()'