Android AccessibilityService compatible to Kindle Fire? - android

I try to develop an Android application to handle the notifications from other apps and send them to my laptop to notify the user. I use the AccessibilityService to handle the notifications on devices with Android < 4.3 (API Level 18) and the NotificationListenerService for devices with android >= 4.3.
There are no issues getting the notifications on my only android device (Samsung Galaxy S with Android 2.3.3), but I need to activate the App in the accessibility settings.
Now I tried to debug the app on my Kindle Fire (API Level 17) and my apps Activity works fine, but the app is not listed in the accessibility settings of the device. The Amazon App testing service returns no problem, so I dont know where I should search the problem.
Is it possible to use the AccessibilityService on the Kindle Fire?
Here is my android manifest file:
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
<uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="18"
/>
<application
android:icon="#drawable/ic_launcher"
android:allowBackup="true">
<activity
android:name="de.test.notificationdistributor.SettingsActivity"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="de.test.notificationdistributor.NotificationDistributorService">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<service
android:name="de.test.notificationdistributor.NotificationDistributionDeprService">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
</service>
</application>

You must add the permission android.permission.BIND_ACCESSIBILITY_SERVICE (added in API 16 - android 4.1)
<service
android:name="de.test.notificationdistributor.NotificationDistributorService"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<meta-data android:name="android.accessibilityservice" android:resource="#xml/accessibilityservice" />
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
In the doc http://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html
Additionally an accessibility service must request the BIND_ACCESSIBILITY_SERVICE permission to ensure that only the system can bind to it. Failure to declare this intent will cause the system to ignore the accessibility service.

Related

android - BOOT_COMPLETED is not working in android version 7.1 and below

I scheduled alarms and i need to reschedule it after reboot the device, it is not working in android 7.1
I have registered receiver in AndroidManifest.xml and permission but no luck. It is working correctly in android 8 and above
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<receiver android:name=".services.StartBootReceiver" android:enabled="false">
<intent-filter>
<actionandroid:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

Google Play invisible app for certain smartphone

I'm new to Android developing and I'm facing a strange issue:
I published my app on google play with a minimum api level of 18 (android 4.4).
I tested my app with many android version and run fine except one device.
A Chinese smartphone (cubot P9) running android 4.5.5 don't see the app at all in the google play.
Despite of the android version should be compatible the play store mark the app as incompatible.
I can't believe the phone report a fake android version?
Can anyone give me an explanation?
The manifest file:
...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name=".Global"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name=".FirebaseIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service
android:name=".GPS_Service"
android:process=":myGPS_service" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="mynotificationchannel" />
<activity android:name=".VisualizzaImmagine"></activity>
<activity android:name=".ShowInNewActivity"></activity>
</application>
...
I'd suggest to double check the versions declared in the manifest, for instance I didn't find a android:minSdkVersion in the attached manifest.
Also revise the phone capabilities, maybe your app requires some features such as screen density or specific hardware that are not available on the device.
Also if you have access to real device, you can develop a simple app to log/display the Android OS version:
Log.v("OS Version",String.valueOf(android.os.Build.VERSION.SDK_INT));
and check if it's really supported by your app, you can verify that also from this table:
https://developer.android.com/reference/android/os/Build.VERSION_CODES.html

Installing wear/mobile app on android wear device does not work

I have developed a android wear demo application. The Android wear description mentions that the wear application is automatically installed on the wear device when installed on the mobile device.
My problem is now that this does not work. The app was created with Android studio.
Wenn I start the waer (sided) app with debugging enabled it installs the app on the wear device and it works ok. Once I install the mobile app (which includes the waer app) the wear on the wear device is deleted, bit the waer not installed on the wear device anymore.
Same happens when I want to debug the apps. Whenever I debug the mobile app the app on the wear device is deleted but not installed.
As written the curios thing is that I can install the wear app directly from within Android stuudio.
All the settings look ok, created automatically by Android studio.
The mobile manifest looks like that:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.waldhoer.klemens.klemenswearsampleapp" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".KlemensActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".FallRecognitionService" android:enabled="true"></service>
<service android:name=".DataLayerListenerService" android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
<uses-permission android:name="android.permission.BODY_SENSORS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
The wear manifest like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.waldhoer.klemens.klemenswearsampleapp" >
<uses-feature android:name="android.hardware.type.watch" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault" >
<activity
android:name=".KlemensWearActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".WearFallRecognitionService" android:enabled="true"></service>
<service android:name=".DataLayerListenerService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
<uses-permission android:name="android.permission.BODY_SENSORS" />
</manifest>
I also created a release version of the (mobile) app with Key signed, did not change anything.
Any idea what could be wrong? Thanks for help!

Specific device not receiving Google Cloud Messaging notifications

I have an application where I'm implementing Google Cloud Messaging notifications, but in a specific device the messages don't arrive. This device has the minimum requirements to use GCM (Android version 2.2, Play Store installed and an Google Account logged). In the log I see that the device is receiving the registration id and sending to the back-office where I have a list of devices registered.
My question is: Do I need to make extra configurations to make the device receive these notifications?
Here is the manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.testegcm"
android:versionCode="1"
android:versionName="1" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.example.gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" />
<application
android:name="TesteGCM"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<receiver
android:name="br.com.testegcm.GcmBroadcastReceiver"
android:exported="true"
android:enabled="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="br.com.testegcm" />
</intent-filter>
</receiver>
<service android:name="br.com.testegcm.GcmIntentService" />
<activity
android:name="br.com.testegcm.Home"
android:screenOrientation="portrait"
android:label="#string/app_name"
android:theme="#style/notitle" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Change this :
<permission android:name="com.example.gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" />
to :
<permission android:name="br.com.testegcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="br.com.testegcm.permission.C2D_MESSAGE" />
Add the same issue and i eventually i realized that i need to change in the manifest, the broadcast receiver package name from com.example.gcm to my package name :
<!-- Push notifcations-->
<receiver
android:name=".BroadcastRecivers.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="com.example.gcm"/>
</intent-filter>
</receiver>
To
<!-- Push notifcations-->
<receiver
android:name=".BroadcastRecivers.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="MY PACKAGE NAME"/>
</intent-filter>
</receiver>
No apart from Android version 2.2, Play Store app installed and an Google Account logged in no other configuration is needed, Now there are only two cases left
1) Either there is some ambiguity in your code.
2) or may be it is a device specific issue.
I had the very same problem.My code would work on nexus4(Kitkat) but would fail to get me a notification from the appln server(via gcm server).For versions less that 4.0.4 you should make sure that you have your google account setup on your device for gcm to work. I had google account on my phone but the mistake I made was that my Account and Sync settings in my galaxy ace was 'Off'.When I turned it ON and ran my code, i received the notification.
Please check the following solution. if still didn't work, let me know.
Add RECEIVE and REGISTRATION Intent in two different intent filters
<receiver
android:name=“<.GCM BroadcastReceiver Name>“ // Name of your BroadcastReceiver, define in code.
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name=“<Package Name>" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name=“<Package Name>" />
</intent-filter>
</receiver>
<service android:name=“<.GCM IntentService Name>" /> // Name of your IntentService, define in code.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Add RECEIVE and REGISTRATION Intent in two different intent filters as shown as above otherwise it won’t work for some devices(Ex. HTC).

Android <receiver> - BroadcastReceiver not called

I have specified a receiver in the manifest like so ..
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.MyProject"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<application android:label="#string/app_name"
android:icon="#drawable/ic_launcher" android:enabled="true">
<service android:name="MyService"
android:exported="true"
android:process=":different"
android:enabled="true">
<intent-filter>
<action android:name="com.me.MyService">
</action>
</intent-filter>
</service>
<receiver android:exported="true"
android:name="MySMSBroadcastReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
</application>
If I test this on an Android Froyo device (emulator or real) this works as I expect. The MySMSBroadcastReceiver.onReceive(...) is being called when the device receives an SMS.
However if I install this on a 4.0 or 4.1 device (either emulator or a real device) nothing happens on an incoming message. No errors, no nothing. I also changed the properties for the project to target a 4.0 or 4.1 device specifically and re-installed it but that makes no difference.
After your application is installed, the user need to launch an activity of yours manually before any of your BroadcastReceivers will have an effect, as of Android 3.1.
You can start the receiver on OS startup giving the right permissions.

Categories

Resources