Android check if device has notification access - android

So I am using the notifications access to know when certain apps are open and such, which works fine on Android O, but the problem I am having is that some devices apparently do not have access to this feature, so it displays this message.
This feature is not available on this device
Is there a way to know if the phone even has this feature available or not programmatically?
EDIT:
This is the code I currently use to send the user to the notification screen so they can enable access for my app, but as above, some devices like Moto E5 the phone itself does not allow this feature.
startActivity(new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS));

Related

How to solve "For your messages security, System message app has been set as the default message app” issue on Oppo devices?

I implemented an SMS app. Now I'm having trouble with Oppo devices because whenever a message is received, the system changes the default app to the built-in app and shows this message:
For your messages security, System message app has been set as the default message app
I need to solve this issue programmatically as thousands of users will be using the app and I cannot let them change it manually
Found this in a other thread on OPPO:
Whatever settings you change for the messaging will not make any difference, the phone will always revert to the default app.
I took this up directly with OPPO and had the following response:
We decided not to allow customer to set 3rd party applications as default message application, for security of the devices cannot be guaranteed. We also want to let you experience our built-in application and to be spared from the malfunction like virus, bug or etc.
Not the response I wanted or expected!
Possibly the phone has been set this way is because in China the government is granted access to all private communications as a way to preserve a permanent dictatorship? Thus Chinese brands may be knowingly spreading these settings in android devices around the world.

Android Wear (5.0) with Android Marshmallow's permission model

I'm in the middle of building a Wear App for an existing phone app.
We plan on targeting API 23 and modifying our phone app's location permissions to work with Android new runtime permission model (https://developer.android.com/training/permissions/index.html)
I was trying to figure out how the Wearable device running Android 5.0 is going to work once we do that. From what I've learnt when asking for locations for the Wearable from https://developer.android.com/training/articles/wear-location-detection.html:
The wearable may or may not have a GPS radio present. For wearables that do not have a radio, the location data comes from the tethered device.
We don’t need to worry about the source of location data – FusedLocationProvider (as part of the Google Play Service) handles this for you behind the scene.
We are responsible for handling the edge case where the wearable does not have GPS hardware (can be checked via hasSystemFeature()) and if the tethering is interrupted (can be detected via WearableListenerService). An example of this would be when the user goes for a run without the phone. In this case, we are expected to degrade the functionality gracefully.
What’s puzzling me is how this will work when we migrate to the new Marshmallow permission model.
Android Wear is not affected if the hardware has on board GPS since no wear devices run Android 6.0 and the old permission model applies. The problem would come about if a wear device with no GPS hardware is tethered to a device running Android 6.0. In this case, if the wear device requests for the location, it would passed on to the phone and the user has not been asked permission/or has disabled the permission, how will this work at all?
I'm imagining that need to hack around this:
On wearable app start, first check if the hardware has a GPS radio
If no, send a message to the phone to ask if holds the permission for requesting location (use the data sync APIs for this)
If the answer comes back false, then show a message to the user on the wearable and ask if they want to resolve it on the phone.
If the user answers “yes”, push a message to the phone to show an activity where it would just prompt for permission.
Is there a better way to do this?

Android 5.0+ hides "Bluetooth pairing request" from user in notification area

I see this very confusing issue on GPE devices (Nexus, Moto G) with Android 5.0+ (still exists in Moto G with 5.1).
I`m working on android application that connects to a custom board via Bluetooth (RFCOMM). When I initiate connection Android frequently shows "Bluetooth pairing request" dialog and ask user click "pair" button. It is normal behaviour.
But with Google Play Edition devices like Nexus(5,6,9) and Moto G(may be with other GPE devices too). This messages do not appears to user. Instead android hides it in notification area. As result users do not understand that some user actions required. From user prospective app hangs up.
This dialog is not a part of the application. With Samsung Galaxy devices I do not see this issues.
Is there any workaround to show this dialog on top always?
I can think about two options:
You could start an Intent that would bypass the lock screen (if there is one) and display a msg to the user that an action is required (Android Lollipop - Bypass lock screen for popup activity).
You could add your own notification with a beep (using the MediaManager) and vibration to make sure the user is aware that he needs to approve the pairing. bear in mind that the user can configure the phone not to display notifications on any device running Android 5.x (in settings->sound and notifications) so It's won't always solve your problem.
Good luck!

Android 4.4 SMS APIs - Unable to change default SMS app in tablets

I checked out the sample code for making your app the default sms client (found here), and the sample project works great on my Nexus 4 running 4.4. There is a button that when clicked, it does the following:
Intent intent = new Intent(Intents.ACTION_CHANGE_DEFAULT);
intent.putExtra(Intents.EXTRA_PACKAGE_NAME, context.getPackageName());
context.startActivity(intent);
and that makes the 'change sms app' dialog appear, that allows the user to switch their default sms application.
When I run the exact same project on my Nexus 7 (2012, Wifi), the button does nothing, although I can read in Logcat that the intent starts. The same thing happens with a Nexus 7 2013, wifi model I checked.
I tried downloading some sms app from the market and the exact same thing happens in all of them. They work great in my N4, no luck in my N7.
Anyone facing the same issue? Did they cut out the ability to write messages to devices that are unable to send texts as a whole?
Edit: Just noticed that the Telephony documentation writes:
Note: These APIs are not available on all Android-powered devices. If your app depends on telephony features such as for managing SMS messages, include a element in your manifest that declares the "android.hardware.telephony" hardware feature. Alternatively, you can check for telephony availability at runtime using either hasSystemFeature(PackageManager.FEATURE_TELEPHONY) or getPhoneType().
So, I'm guessing that if the device doesn't have the above feature it cannot 'manage SMS messages' (be the default SMS app).
It seems that sms no longer works on the Nexus 7 3G if you upgrade to Android 4.4.
In the past, some people have been able to use sms on their tablets by downloading and installing a third party sms app . Even though there is no stock messaging app with the ROM (and AFAIK, this is not an official feature), this has generally worked.
However, Android 4.4 KitKat on the Nexus 7 3G takes away this feature.
In Android 4.4, a messaging app must be set as the "default sms app" so it can be allowed to save new messages to the phone's message database. In other words, a messaging app must be the default sms app in order to operate fully.
In the Nexus 5 (and Android emulators), there is a setting Settings » ... » Wireless » Default sms app which allows you to choose your default sms app.
In the Nexus 7 3G, this setting DOES NOT EXIST.
It seems that the "default sms app" is not supported on the Nexus 7. In other words, you cannot set an app to be the default sms app. That means it is not possible to use an sms app.

Device Administration App Remotely clear data on Android Phone

I am creating a application in android similar to Device Policy Administration that can remotely clear the data on the Android device.I have followed the sample in the android docs here http://developer.android.com/guide/topics/admin/device-admin.html
I need some assistance on how this is implemented.I have come across some apps that perform such tasks of remotely accessing the device(like clear data on the device,Ring the device to full volume).My doubt is
1.How did they implemented this functionality in android what concept have they used to send request to the app to ring the device?Is it via Push notification?
2.Also even if i mark Settings->Security->Device administrators->Android Device Manager(ADM)->Deactivate and from the console (https://www.google.com/android/devicemanager?u=0)
I Ring the Device...the device Rings.Shouldnt it not ring until and unless i dont activate the ADM.
3.Also even if i do not launch(start) the app ,I am still able to Ring my device.Does it mean that whenever i start my device my Device Administration App gets launched automatically?
Any help will be highly appreciable.
How did they implemented this functionality in android what concept have they used to send request to the app to ring the device?Is it via Push notification?
The Android Device Manager is a proprietary service and piece of software. You will need to get a job at Google, join the ADM team, and then learn how it is done.
That being said, a GCM-style push notification is a likely solution.
Does it mean that whenever i start my device my Device Administration App gets launched automatically?
No. Device administration != always running. Device administration status simply gives you access to other APIs that normal apps cannot use.
Note that a GCM-style push notification can be delivered to an app that is not already running.
The rest of your question has nothing to do with programming and everything to do with the proprietary implementation of ADM, which makes it off-topic for StackOverflow.

Categories

Resources