I want to know how to launch an Android app
without:
android.intent.category.LAUNCHER
Here is my AndroidManifest.xml
:
<intent-filter>
<action android:name = "android.intent.action.MAIN" />
<category android:name = "android.intent.category.LAUNCHER" />
</intent-filter>
If removing line 3, the app will not be in the launcher. The question is: where and how can I launch this app in other way?
category: android.intent.category. DEFAULT. Matches any implicit Intent. This category must be included for your Activity to receive any implicit Intent.
Just use these following two lines, so you can launch any installed application whose package name is known: Intent launchIntent = getPackageManager(). getLaunchIntentForPackage("com. example.
Sure! No reason you cannot have an application with only a service. ...and no need to get into AIDL unless you want to. The problem is, how to make the application run. When you create an application with an Activity, you add an Intent filter, in the manifest, that makes the activity startable from the Launcher.
Android Intent is the message that is passed between components such as activities, content providers, broadcast receivers, services etc. It is generally used with startActivity() method to invoke activity, broadcast receivers etc. The dictionary meaning of intent is intention or purpose.
You'll need to use a BroadcastReceiver
.
public class SafetyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
ActivityManager as = (ActivityManager) context
.getSystemService(Activity.ACTIVITY_SERVICE);
if (IsNavigationRunning(as)) {
Intent i = new Intent(context, VoiceActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
}
Manifest:
<application
android:icon="@drawable/fot"
android:label="@string/app_name" >
<activity
android:name="com.Safety.VoiceActivity"
android:launchMode="singleTop"
android:theme="@style/Theme.CompletelyTransparentWindow" >
</activity>
<receiver
android:name="com.Safety.SafetyReceiver"
android:process=":goodprocess" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
This is an example that starts when a text is received.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With