I implemented reverse geocoding inside GCMIntentService onMessage method. I got exception java.lang.SecurityException: Not allowed to bind to service Intent { act=com.android.location.service.GeocodeProvider pkg=com.google.android.location }
after application running long time. If i restart device it works again fine. Also i seen android open isssue Reconnection with Geocoder services not possible when Network Location Service is killed.. Is it any work around to solve this issue?
Note : I am running Application in Samsung galaxy Tab 2(Android 4.1.1)
Related
I have app that works fine in Android 10 but now I need to make it work on Android 11.
App uses broadcast receiver so it can be launched from background on notification widget/view
First issue was that when I run it on 11 I got android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1):
So I added permissions android:foregroundServiceType="camera" so I got it run at first place
Now when the app is in background and is activated from widget via broadcast message
the app doesn't activate. I get the the receiver message and when getting the Controller.getInstance(context)
and I check the context cameradevice it's null.
I found this https://developer.android.com/guide/components/foreground-services#access-restrictions
I am just guessing that if this is the case shouldn't there be some Permission Restricted Message instead of having the cameradevice is null.
And if this is the case that it now fails with access restrictions is there way to make it work.
I'm starting to develop for android, and I'm having an issue about services. I did a lot of research about this, but couldn't find a solution.
I'm doing an app that collects RFID tags information. For that, I'm using a third-party middleware that handles the bluetooth connection to the RFID reader and other events (like connecting, reading, errors etc). So, my app creates a broadcast receiver that handles all the message and data intents sent by the middleware. For this part, everything's fine.
The problem is that I'm trying to start middleware service using the code below (provided by the middleware documentation), but it doesn't work.
Intent intent = new Intent("com.supplier.middleware.runner");
intent.setPackage("com.supplier.middleware");
startService(intent);
I'm currently using an Asus Zenfone MAX M1 (ASUS_X00HD) with Android 8.1.0. The documentation also describes a way to stop the service (which I must use when I close the app), and the stop service intent works. So, if I start the middleware manually and try to close programatically, it works fine.
After some days trying - unsuccessfully - to solve this, I tested my app with a Motorola Moto Maxx (which is Android 6, I think) and with a Samsung J1 (which is Android 5.1.1) and both smartphones worked fine: when I call the startService, a notification item appears; when I call stopService, the notification item goes away.
I also tried to use "startForegroundService" because of the Android 8, but no success either.
Is there a way to "monitor" the startService calls, so maybe I could track any error? Am I doing something wrong - or rather, am I not doing something that is important?
In Android 8.0 background service limitation.
https://developer.android.com/about/versions/oreo/background.html
You can use JobIntentService instead of intent service. It can work.
I'm running the Google Codelab Android Activity Recognition API example on my Samsung 8+
https://codelabs.developers.google.com/codelabs/activity-recognition-transition/
And although the example starts fine on my phone, I do not get any events from the activity recognition API.
I first though that it might be a permission issue, but On Android 9 I could not find a permission setting for the ACTIVITY_RECOGNITION, this seems to be necessary for Android 10 onwards.
Could someone give a pointer what possible reasons might be that my Samsung 8+ is not getting any Activity Recognition events?
I have 2 Xiaomi phone that is running Android 9. 1 is Redmi Note 3 and is working . The other 1 is Pocophone and it is not working.
Then I tested with Samsung Galaxy Grand Prime Android 5. It is working. Now I am confused why some device it appears but some not appear.
Even registering broadcast receiver in Manifest file,you need to register in dynamically in Oreo+ otherwise it will not work.
Try this.Add this code in main activity or in startCommand in Service.It worked for me.I have tested this code on Android 10 too..worked perfectly.You dont need to register broadcast receiver in Manifest.
#Override
protected void onStart() {
super.onStart();
IntentFilter intentFilter=new IntentFilter(Constants.BROADCAST_DETECTED_ACTIVITY);
intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
registerReceiver(broadcastReceiver,intentFilter);
}
I've noticed in Google Play Console crashes that I get ClassCastException when casting to a CustomApplication in a Service or BroadcastReceiver:
((CustomApplication) getApplication()).getDiComponent().inject(this);
The name is set in manifest:
<application
android:name=".CustomApplication"
I also tried using getApplicationContext() but got same result:
((CustomApplication) getApplicationContext()).getDiComponent().inject(this);
This code is used in onCreate() method of a Service or onReceive of a broadcast receiver.
I cannot reproduce this crash but I have quite a lot looking at numbers. Any idea why it happens and how I could fix it?
UPDATES
OS affected: from 6.0 and up
Devices: mostly ZTE phones, 70%, but some Samsung also
I followed all the guidance found on SO to autostart app at boot time.
In my manifest, I have set the right permission (RECEIVE_BOOT_COMPLETED) and also declared my broadcast receiver: .BootReceiver picking up Android.Intent.Action.BOOT_COMPLETED.
I also launch my service in BootReceiver, this is very straightforward stuff.
The thing is, my app starts at boot time on certain devices (I hope most devices) but not on some of them. I have a Xiaomi phone that gives me the following error at boot time:
"Unable to launch app com..example/10120 for broadcast Intent {act=android.intent.action.BOOT_COMPLETE flg=0x8000010 (has extras) }: process is not permitted to autostart."
I am surprised to see this message, because I can see that the list of permissions includes running at startup.
There must be a way, because Whatsapp for instance is launched at boot time.
Any clue would be highly appreciated.
Same here. I tried to delete the file in the SD card ( but the system direct to internal storage ) by using the permission WRITE_EXTERNAL_STORAGE, and get the similar message from log-cat. Maybe it can be fixed by rooting the xiao-mi mobile, that's what I searched from the Internet.