Android : Some Useful Intents

Post Reply
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Android : Some Useful Intents

Post by tong »

Implicit Intent

เป็นรูปแบบการใช้งาน Intent ที่ไม่ได้ระบุ Component หรือ Class อย่างเจาะจง จะเป็นตัวไหนก็ได้ ขอแค่ตรงกับเงื่อนไขที่กำหนดไว้ก็พอ ซึ่งเงื่อนไขที่ว่าก็คือ Action, Type และ Category

Code: Select all

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "Hello World");
intent.setType("text/plain");
startActivity(intent);

Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "Hello World");
intent.setType("text/plain");
startActivity(intent);
Explicit Intent

เป็นรูปแบบการใช้งาน Intent ที่มีการระบุ Component หรือ Class ปลายทางอย่างเจาะจง

Code: Select all

String packageName = "com.google.android.apps.photos";
String className = "com.google.android.apps.photos.home.HomeActivity";

Intent intent = new Intent(packageName, className);
startActivity(intent);

Intent intent = new Intent();
intent.setClass(packageName, className);
startActivity(intent);

Intent intent = new Intent();
intent.setComponent(new ComponentName(packageName, className));
startActivity(intent);
http://www.akexorcist.com/2017/01/android-intent-and-pending-intent.html
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android: Some Useful Intents

Post by tong »

...
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android: Some Useful Intents

Post by tong »

Google Play - My apps & games (Updates)

Code: Select all

Action  : com.google.android.finsky.VIEW_MY_DOWNLOADS
Package : com.android.vending
Class   : com.google.android.finsky.activities.MainActivity
Target  : Activity
Google Play - Games

Code: Select all

Action: android.intent.action.VIEW
Data: https://play.google.com/store/apps/category/GAME
Target: Activity
Google Play - Apps

Code: Select all

Action: android.intent.action.VIEW
Data: https://play.google.com/store/apps
Target: Activity
Google Play - Movies

Code: Select all

Action: android.intent.action.VIEW
Data: https://play.google.com/store/movies
Target: Activity
Google Play - Books

Code: Select all

Action: android.intent.action.VIEW
Data: https://play.google.com/store/books
Target: Activity
Android monitor filter urls and launch Google Play automatic.
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android: Some Useful Intents

Post by tong »

Reset Ads ID

Code: Select all

Action  : com.google.android.gms.settings.ADS_PRIVACY
Target  : Activity
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android: Some Useful Intents

Post by tong »

App Info FIFA Mobile

Code: Select all

Action  : android.settings.APPLICATION_DETAILS_SETTINGS
Data    : package:com.ea.gp.fifamobile
Target  : Activity
App Info Gboard

Code: Select all

Action  : android.settings.APPLICATION_DETAILS_SETTINGS
Data    : package:com.google.android.inputmethod.latin
Target  : Activity
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android: Some Useful Intents

Post by tong »

Start FRep Service

Code: Select all

Action  : android.intent.action.MAIN
Extra   : wakeuponly:true
Package : com.x0.strai.frep
Class   : com.x0.strai.frep.FingerActivity
Target  : Activity
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android: Some Useful Intents

Post by tong »

Developer Options

Code: Select all

Action  : android.settings.APPLICATION_DEVELOPMENT_SETTINGS
Target  : Activity

https://developer.android.com/reference/android/provider/Settings
https://androidforums.com/threads/setting-intents.1126042/

Code: Select all

android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS

change to

android.settings.APPLICATION_DEVELOPMENT_SETTINGS
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android: Some Useful Intents

Post by tong »

Open web in Chrome

Code: Select all

Action  : android.intent.action.VIEW
Data    : https://www.google.com
Package : com.android.chrome
Class   : com.android.chrome.activities.BrowserInterceptActivity
Target  : Activity
com.google.android.apps.chrome.Main
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android: Some Useful Intents

Post by tong »

Tethering Settings

Code: Select all

Package : com.android.settings
Class   : com.android.settings.TetherSettings
Target  : Activity
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android: Some Useful Intents

Post by tong »

Media Scan

Code: Select all

Action  : android.intent.action.MEDIA_SCANNER_SCAN_FILE
Data    : file:///sdcard/ or content://sdcard/
Target  : Broadcast
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android : Some Useful Intents

Post by tong »

Code: Select all

pm clear com.ea.gp.fifamobile
/system/bin/reboot bootloader
/system/bin/reboot recovery
svc power reboot
svc power shutdown
/system/bin/input keyevent 26
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android : Some Useful Intents

Post by tong »

Bluetooth Settings

android.settings.BLUETOOTH_SETTINGS
android.bluetooth.devicepicker.action.LAUNCH
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Android : Some Useful Intents

Post by tong »

Create DropSync "Sync Now" shortcut on MIUI

Code: Select all

Action  : android.intent.action.MAIN
Package : com.ttxapps.dropsync
Class   : com.ttxapps.sync.app.SyncNowShortcutActibity
Target  : Activity
Post Reply