Opening status bar notification from code in android - android

Is it possible to open status bar notification from code? I already tried checking NotificationManager but found only methods that close current notifications. Any suggestion would be appreciated.

For anyone wondering it's possible to open if you provide package name:
Intent i = new Intent();
i.setPackage(sbn.getPackageName());
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);

Related

How to Open Notification center from Application

I am using following code to open Application settings, but I need to open Notification center from my application.Is it possible to open Notification center from the application? If so, Please guide a way to do so.
Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.parse("package:" + getPackageName()));
startActivity(intent);
Try this one:
Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS
Documentation says (link):
Activity Action: Show Notification listener settings.
In some cases, a matching Activity may not exist, so ensure you
safeguard against this.

Android App's Icon is Missing from menu - xamarin

I am writing an app and I was just about to implement Google Indexing api and then I have faced the problem. I can install the app and I can see it in app list on my android device(Settings->Applications->MyApp) but I do not see icon in the menu. Also, I can trigger and start the app from CMD with command adb shell am start and the app is working correctly, but if I kill the app I cannot start it again because there is no launch icon.
I have tried to generate .apk and I got the same behavior.
In Manifest file there is
Can you please help me to solve this issue?
thanks!
Your question is not quite clear: ...but I do not see icon in the menu...
do you mean you do not see it in the homescreen??
If you want to add your app icon to the homescreen you can do it with the following method:
private void AddShortcut()
{
var shortcutIntent = new Intent(this, typeof(ActivityMain));
shortcutIntent.SetAction(Intent.ActionMain);
var iconResource = Intent.ShortcutIconResource.FromContext(
this, Resource.Drawable.yourAppIcon);
var intent = new Intent();
intent.PutExtra(Intent.ExtraShortcutIntent, shortcutIntent);
intent.PutExtra(Intent.ExtraShortcutName, "yourAppName");
intent.PutExtra(Intent.ExtraShortcutIconResource, iconResource);
intent.SetAction("com.android.launcher.action.INSTALL_SHORTCUT");
SendBroadcast(intent);
}

How to start the standard Stopwatch activity in Android (particularly Andorid Wear) programmatically?

I am working on a launcher application for Android Wear, and would like to include icons for the default actions such as "Set Alarm", "Set Timer", "Show Alarms" or the Stopwatch.
I found the way to start alarm clock related activities using the following intents:
AlarmClock.ACTION_SET_TIMER or "android.intent.action.SET_TIMER"
AlarmClock.ACTION_SET_ALARM or "android.intent.action.SHOW_ALARMS"
AlarmClock.ACTION_SHOW_ALARMS or "android.intent.action.SET_ALARM"
I can start them by:
Intent i= new Intent(AlarmClock.ACTION_SET_TIMER);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
context.startActivity(i);
If started without any extras, they simply bring up the corresponding UI. Perfect!
Except, I can't find the corresponding action for the Stopwatch. Do you know the intent? Where should I look?
Use #promanowicz 's answer like this:
Intent intent = new Intent("com.google.android.wearable.action.STOPWATCH" );
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
startActivity(intent);
Maybe this will help someone. At the moment there is intent action 'com.google.android.wearable.action.STOPWATCH' which you can use.
According to this training- Adding Voice Capabilities
The starting and stopping Stopwatch is not exposed via public API or intent

How to hide notification bar of settings intent?

I am making an custom system setting application my goal is user can not see notification bar so i used this code its working fine.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
but the problem is when i open settings intent from my app it shows notification bar i want to remove notification bar from this intent too how i can do this.
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
my device is rooted i am making my own launcher please guide me how i can do this.
sorry for poor English i tried my best to explain my problem
You can try using this:
Intent i = new Intent(Settings.ACTION_WIRELESS_SETTINGS);
i.putExtra(":android:show_fragment", "com.android.settings.wifi.WifiSettings");
i.putExtra(":android:no_headers", true);
startActivity(i);

What is the Intent to call "Choose screen lock" screen?

I cant find any refrence to call the Intent screen "Choose screen lock".
Cant find anything?
Any idea?
You can call action DevicePolicyManager.SET_NEW_PASSWORD to send user to lock screen settings fragment (firstly he will have to type current password/pattern for secure lock types):
Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
startActivity(intent);
There is none. You can view all possible Intents in android's source code: https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml
EDIT:
It turns out that this had been added in Version 2.2 of Android.
Please ee pleczko's answer below.
Before Android 2.2 there is no intent to do this.

Categories

Resources