¿Cuáles son las formas alternativas de lanzar mi aplicación?

Puedo iniciar mi aplicación por:

  1. Tocando en su icono en el lanzador
  2. Registrar el filtro de intenciones "visible" (quiero decir: los clics del usuario por ejemplo "Enviar con .." luego elige mi aplicación)
  3. Introduciendo el código numérico en el marcador y la "llamada" – intención "invisible", el usuario no puede elegir la aplicación, sólo introduce el código

¿Hay otras formas de lanzar mi aplicación? (Estoy más interesado en algo más como la intención "invisible" del párrafo 3).

  • Supongamos que tenemos un dispositivo limpio solo con aplicaciones predeterminadas del sistema (la mayoría de las aplicaciones de Google también se consideran como predeterminadas) y mi aplicación
  • Se prefieren las maneras de los usuarios habituales, pero los enfoques más difíciles también serán útiles
  • Las variantes, que pueden usarse en un dispositivo (no se necesitan otros dispositivos necesarios para aproximarse), también serán útiles "variantes de más de un dispositivo".

También puedes ejecutar tu aplicación desde el navegador web:

<intent-filter> <data android:scheme="my.special.scheme" /> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> </intent-filter> 

Puede iniciar su aplicación en la transacción NFC:

En el mainfest <uses-feature android:name="android.hardware.nfc" />

Lea más sobre esto aquí: LINK


También puede registrar un receptor e iniciar la aplicación cuando reciba sms con código secreto en él:

  public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras(); Object messages[] = (Object[]) bundle.get("pdus"); SmsMessage smsMessage[] = new SmsMessage[messages.length]; for (int n = 0; n &lt; messages.length; n++) { smsMessage[n] = SmsMessage.createFromPdu((byte[]) messages[n]); } String text = smsMessage[0].getMessageBody(); if(text = "yoursecretcode") { //launch the app abortBroadcast(); //if you want to hide this messeage } } 

Permiso requerido: <uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>


También puede registrar un receptor e iniciar la aplicación cuando reciba una llamada del número de teléfono seleccionado:

 public class ServiceReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { MyPhoneStateListener phoneListener=new MyPhoneStateListener(); TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); telephony.listen(phoneListener,PhoneStateListener.LISTEN_CALL_STATE); } } public class MyPhoneStateListener extends PhoneStateListener { public void onCallStateChanged(int state,String incomingNumber){ switch(state){ case TelephonyManager.CALL_STATE_RINGING: String numer = TelephonyManager.EXTRA_INCOMING_NUMBER; // launch your app if 'numer' is ... break; } } } 

Necesita este permiso de READ_PHONE_STATE


También puede usar shell para hacer esto (el teléfono debe estar enraizado):

Por ejemplo :

 Runtime.getRuntime().exec("su"); Runtime.getRuntime ().exec ("am start -n com.android.calculator2/.Calculator"); 

Colega "Arpan" escribió:

Incline su teléfono y agite su mano (Básicamente usando un sensor de proximidad para lanzar la intención de la aplicación)

Te doy código de ejemplo:

 public class SensorActivity extends Service implements SensorEventListener { private SensorManager mSensorManager; private Sensor mProximity; @Override public final void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mProximity = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); } @Override public final void onAccuracyChanged(Sensor sensor, int accuracy) { // Do something here if sensor accuracy changes. } @Override public final void onSensorChanged(SensorEvent event) { float distance = event.values[0]; if(!ss()) // LAUNCH YOUR APP IF ISN't RUNNNING } @Override protected void onResume() { // Register a listener for the sensor. super.onResume(); mSensorManager.registerListener(this, mProximity, SensorManager.SENSOR_DELAY_NORMAL); } @Override protected void onPause() { // Be sure to unregister the sensor when the activity pauses. super.onPause(); mSensorManager.unregisterListener(this); } } private boolean ss() { ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if ("com.packagename.something.ActivityName".equals(service.service.getClassName())) { return true; } } return false; } 

"Arpan" también escribió:

Conecte cualquier dispositivo usb y poner un filtro de intención en el manifiesto (Si el modo host usb disponible)

 public static boolean isConnected(Context context) { Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); return plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB; } 

Puede pegarlo en Timer


He editado el post de Arpan, he añadido el enlace sobre Gesture Search en Android®.


Usted puede lanzar la aplicación usando el widget (cuando el usuario haga clic en esto, la aplicación se iniciará), le doy código de la clase widget snipet, más se puede encontrar aquí :

 package com.helloandroid.countdownexample; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; public class CountdownWidget extends AppWidgetProvider { @Override public void onDeleted(Context context, int[] appWidgetIds) { //called when widgets are deleted //see that you get an array of widgetIds which are deleted //so handle the delete of multiple widgets in an iteration super.onDeleted(context, appWidgetIds); } @Override public void onDisabled(Context context) { super.onDisabled(context); //runs when all of the instances of the widget are deleted from //the home screen //here you can do some setup } @Override public void onEnabled(Context context) { super.onEnabled(context); //runs when all of the first instance of the widget are placed //on the home screen } @Override public void onClick() { //your code to launch application... } @Override public void onReceive(Context context, Intent intent) { //all the intents get handled by this method //mainly used to handle self created intents, which are not //handled by any other method //the super call delegates the action to the other methods //for example the APPWIDGET_UPDATE intent arrives here first //and the super call executes the onUpdate in this case //so it is even possible to handle the functionality of the //other methods here //or if you don't call super you can overwrite the standard //flow of intent handling super.onReceive(context, intent); } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { //runs on APPWIDGET_UPDATE //here is the widget content set, and updated //it is called once when the widget created //and periodically as set in the metadata xml //the layout modifications can be done using the AppWidgetManager //passed in the parameter, we will discuss it later //the appWidgetIds contains the Ids of all the widget instances //so here you want likely update all of them in an iteration //we will use only the first creation run super.onUpdate(context, appWidgetManager, appWidgetIds); } } 

compruebe si los auriculares están enchufados

Siempre que los auriculares estén enchufados, se disparará una intención ( ACTION_HEADSET_PLUG ). Compruebe esto a través de BroadcastReceiver y inicie Acitivity

 IntentFilter f = new IntentFilter(); f.addAction(Intent.ACTION_HEADSET_PLUG); registerReceiver(headsetPlugReceiver, f); public BroadcastReceiver headsetPlugReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // start new Activity or do something else } }; 

Y en Manifiesto:

 <receiver android:name="activity.to.receive.headplug.event"> <intent-filter> <action android:name="android.intent.action.HEADSET_PLUG" /> </intent-filter> </receiver> 

  1. Incline su teléfono y agite su mano (Básicamente usando un sensor de proximidad para lanzar la intención de la aplicación)
  2. Toque en la pantalla y / o Gesto para lanzar una intención (puede leer sobre esto AQUÍ )
  3. Conecte cualquier dispositivo usb y poner un filtro de intención en el manifiesto (Si el modo host usb disponible)
  • ¿Cuál es el propósito de "android.intent.category.DEFAULT"?
  • Obtenga la etiqueta NFC con NDEF Android Application Record (AAR)
  • Cómo corregir Advertencia de pelusa de SMS BroadcastReceiver sin protección
  • Abrir URL de Facebook con la aplicación de Facebook
  • Enviar una transmisión sólo a actividades específicas
  • Cómo filtrar sólo una URL específica con filtro de intenciones
  • ¿Es posible iniciar una aplicación cuando se escanea una etiqueta NFC?
  • Enlace profundo de Android que funciona sólo en algunos sitios web
  • Abrir la aplicación de Android desde la URL mediante el intento de filtro no funciona
  • IntentFilter en NFC - Xamarin - C #
  • Receptor de difusión de Android y filtro de intenciones
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.