Unable to trigger Broadcast SMS receiver in MIUI Rom - android

I have tested my code on Emulator as well as CM9 ROM. Everything works fine. But when I run my app on MIUI v3.6.28 Android Version 4.1.2 it doesn't trigger the SMS receiver.
I searched around on StackOverflow but couldnt find suitable answer except one mentioning about Phone manufacturers implementing internal classes themselves to avoid such behaviour. And MIUI being Xiami ROM maybe that is true. But then how would Go SMS and Handcent SMS work on these devices ?

http://miuiandroid.com/community/threads/sms-notification-not-working.16464/
This might solve the problem. I did not check it since I have moved to cm again for testing . but seems to solve exactly what I need. And description makes sense.
Miui takes preference and takes away the SMS before any other app can receive it.

In Xiaomi devices, you just have to add your app to Autostart list, to do so, follow these simple steps given below:
Open Security app on your phone.
Tap on Permissions, it'll show youtwo options: Autostart and Permissions.
Tap on Autostart, it'll show you list of apps with on or off toggle
buttons.
Turn on toggle of your app, you're done!
Note : When ran through your app via USB permissions is denied by
default for READ_SMS. You need to enable permission in Permission tab
of Security app for your app.

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.

GCM notification not received on some Devices

Trying to send GCM notification to the devices asus,xiaomi redmi 1s but not getting the notification while the same notification is getting delivered to the other devices.As given in link
GCM notification not received on one of the mobile devices
these devices having security app such as AutoStart to disable app run in background on install.
So the question is how to notify user to enable app in autostart? Is there any programmatic way to deal with it because in our case if no GCM then there is no use of our app.
If you want any code then I can give it but as I stated above its(GCM) working on other devices and also work on above devices if app is enabled in Autostart,so I think there is no need to add code.
Thanks.
I have been dealing with the same issue from a long time. These devices specially redmi devices create a lot of problem . Redmi doesn't provide enough freedom to deal with notifications programatically. With every new install, you'll have to manually turn on autostart from 'Security' otherwise push notifications might have erratic behaviour. Further you'll have to add
GET_TASKS permission
in these devices which is deprecated

Disable Android from emitting LogCat messages

Is it possible to disable Android on a device from emitting ALL log messages from ALL apps?
On a rooted device maybe. With your own ROM mod, certainly. Otherwise, no. Bear in mind the logs are kept even when your tools are not looking at those logs (e.g., device is disconnected from your development machine).
No, you cannot do this. Some devices (like Huawey's) got logging disabled and you have to do some magic to get this functionality restored, but this is just custom firmware modification by huawey.
On a Huawei device, you dial:
*#*#2846579#*#*
This will bring up an app where you can disable all log messages. I'm sure every device has some secret phone number that lets you do this. No rooting necessary.

find out if power saving mode enabled - Android SDK

I have an app running on Android that uses only a webview to display a mobile web-application and at some point uses the device's GPS to obtain their position.
I have a custom ChromeWebClient etc and it obtains their position nicely except for on devices where the Power Saving Mode is enabled?
Is there anyway in the SDK/API for me to be able to determine if the user has this enabled and to advise them accordingly?
I can't find anything in the docs so i am assuming not but worth a shot,
Cheers,
Lee
After reeding the comments
In my experience Samsung, as well as HTC, is one of the manufacturers that modify Android OS in most unpredictable ways. They add new functions and modes, like 4G switching launcher widgets and "power saving mode". They modify permission requirements for documented SDK methods, i.e. to switch on bluetooth on a Samsung device your app needs to have and additional android.permission.BLUETOOTH permission, while stock Android only needs android.permission.BLUETOOTH_ADMIN. And there's more.
Long story short, as #RaghavSood pointed out, "power saving mode" is not an official AOSP feature and there are no ways to detect it via official SDK. There is a possible way how you can work around it though. I believe it is most likely that your app misbehaves in power saving mode because this mode turns off GPS. You can confirm that by configuring power saving mode in settings to disable GPS disabling(can't phrase this better, sorry) - first link from google with steps. Then test the app. Does it work? If yes, then you've rootcaused the problem and now your job is to let the user know that your app won't run without GPS. You can put some code into your app to detect if GPS service is enabled an show an alert dialog if it isn't. The code in your activity can look something like this:
LocationManager lm = getSystemService(Context.LOCATION_SERVICE);
if(!lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
//Show a notification prompting user to switch on GPS.
}
You can be even more elaborate and make your app detect device manufacturer to show a custom message on all Samsung devices.

How can I suppress the USB permissions dialog?

I am developing an application in which I am communicating with an USB device.
When I connect the USB device for the first time and run the application, it asks for the USB permission.
I want to suppress that dialog so it won't prompt the user anymore. I know that it asks for user permission as per the results I've found so far, however I want to know whether the dialog can be suppressed.
Is their any way by which the user can assign the permissions at install time and wont get that USB permission dialog box?
I think that the answer is that it is not possible.
I have not found a way to suppress this so far. I think that this is primarily down to the fact that the permission is granted to a specific device and of course the device is not likely to be known at install time.
What you would effectively need is a blanket "any USB device" permission and I certainly have not found such a thing so far.
I can take none of the credit for this, but the answer is that it can be done using an intent-filter on USB_DEVICE_ATTACHED - see USB device access pop-up supression? for the solution, including a handy demo app.

Categories

Resources