i am using Accessibility Service to click USSD dialogbox but i want some delay like 3 sec after Dialogbox appered
here is my code
<receiver android:name=".Messagereciver"
android:exported ="true">
<intent-filter android:priority="3000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<service
android:name=".USSDService"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter android:priority="3000" >
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data android:name="android.accessibilityservice"
android:resource="#xml/config_service" />
</service>
i have tried change android:priority 3000 but still same
even in android:notificationTimeout="3000" in config_service
Related
So I want to point the app to start a particular activity instead of the LaunchActivity that was set up. I changed the Manifest to start up with the activity of choice, but it keeps throwing this error
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.parabit.parabeacon.app.demo, PID: 23417
io.reactivex.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | com.parabit.parabeacon.app.demo.exceptions.local_storage_exception.EmptyUserSessionStorageException: local storage is empty
at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
at io.reactivex.internal.observers.ConsumerSingleObserver.onError(ConsumerSingleObserver.java:46)
at io.reactivex.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:79)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:124)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: com.parabit.parabeacon.app.demo.exceptions.local_storage_exception.EmptyUserSessionStorageException: local storage is empty
at com.parabit.parabeacon.app.demo.data_section.LocalStorage.lambda$getUserSessionInfo$18(LocalStorage.java:266)
at com.parabit.parabeacon.app.demo.data_section.LocalStorage$$ExternalSyntheticLambda6.subscribe(Unknown Source:2)
at io.reactivex.internal.operators.single.SingleCreate.subscribeActual(SingleCreate.java:39)
at io.reactivex.Single.subscribe(Single.java:3666)
at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:608)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
The method in question is this:
#Throws(exceptionClasses = EmptyUserSessionStorageException.class)
public static Single<UserSession> getUserSessionInfo(#NonNull Context context) {
return Single.create(emitter -> {
String json = FileUtil.readContentFromFile(USER_SESSION_FILE_NAME, context);
if (json == null) {
emitter.onError(new EmptyUserSessionStorageException());
} else {
emitter.onSuccess(GsonUtil.jsonStrToObject(json, new TypeToken<UserSession>(){}));
}
});
}
And here's the Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.parabit.parabeacon.app.demo">
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name="com.parabit.parabeacon.app.demo.DemoApplication"
android:requestLegacyExternalStorage="true"
android:allowBackup="true"
android:icon="${iconpath}"
android:label="#string/app_name"
android:roundIcon="#mipmap/shape"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name="com.parabit.parabeacon.app.demo.ui_section.HomeActivity"
android:label="#string/title_activity_home"
android:windowSoftInputMode="adjustPan"
android:exported="true">
<meta-data
android:name="android.app.default_searchable"
android:value=".bank_location.SearchableActivity" />
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.parabit.parabeacon.app.demo.ui_section.BtNotificationActivity"
android:label="#string/title_activity_bt_notification"
android:theme="#style/AppTheme.NoActionBar" />
<receiver
android:name="com.parabit.parabeacon.app.demo.receivers.BTServiceReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.parabit.parabeacon.app.sdk_app.receivers.bt_service_action" />
</intent-filter>
</receiver>
<activity
android:name="com.parabit.parabeacon.app.demo.ui_section.LoginActivity"
android:windowSoftInputMode="adjustResize"
android:noHistory="true"/>
<!-- <activity-->
<!-- android:name="com.parabit.parabeacon.app.demo.ui_section.HomeActivity"-->
<!-- android:label="#string/title_activity_home"-->
<!-- android:windowSoftInputMode="adjustPan">-->
<!-- <meta-data-->
<!-- android:name="android.app.default_searchable"-->
<!-- android:value=".bank_location.SearchableActivity" />-->
<!-- </activity>-->
<activity
android:name="com.parabit.parabeacon.app.demo.ui_section.SettingsActivity"
android:label="#string/title_app_settings" />
<activity android:name="com.parabit.parabeacon.app.demo.ui_section.bank_location.BankLocationDetailActivity" />
<activity
android:name="com.parabit.parabeacon.app.demo.ui_section.InviteActivity"
android:windowSoftInputMode="adjustPan"
android:label="#string/title_app_invite" />
<activity
android:name="com.parabit.parabeacon.app.demo.ui_section.InvitedUserActivity"
android:windowSoftInputMode="adjustPan"
android:label="#string/title_app_invited_user" />
<activity
android:name="com.parabit.parabeacon.app.demo.ui_section.bank_location.SearchableActivity"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
<service
android:name="org.altbeacon.beacon.service.BeaconService"
tools:node="replace">
<meta-data
android:name="longScanForcingEnabled"
android:value="true" />
</service>
<receiver android:name="org.altbeacon.beacon.startup.StartupBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>
<activity
android:name="com.microsoft.appcenter.distribute.DeepLinkActivity"
android:theme="#android:style/Theme.NoDisplay"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="updates"
android:path="/"
android:scheme="appcenter" />
</intent-filter>
</activity>
<receiver android:name="com.microsoft.appcenter.distribute.DownloadManagerReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
<action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED" />
</intent-filter>
</receiver>
</application>
</manifest>
For a bit more context. The project is using RxJava to handle the Login process in the app (which is causing another issue in of itself). So I wanted to check the Home Activity and see if the app is still good to go. But I just can't get passed this error. Any ideas or help will be greatly appreciated. Thank you
P.S. I did not code this app. And Java isn't my main coding language I use to code Android, so I'm a bit shaky with it.
I want to add two classes in accessibility service
I have tried this and its showing some errors of tag
<service
android:name=".ClassGen1",".ClassGen2"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
android:persistent="true">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
mistake in your code is writing class names with comma .
android:name=".ClassGen1",".ClassGen2"
Value of name attribute cannot be written with comma in android . You should declare them separately in different service tags . Like as below
<service
android:name=".ClassGen1"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
android:persistent="true">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
</service>
<service
android:name=".ClassGen2"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
android:persistent="true">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
</service>
Recently I'm building a AOSP ROM from source. What I wanted to do is, add a 3rd party application into Settings app and It should be launched only from Settings and it should be invisible from Launcher.
Here's what I did, It fails everytime.
Removed these lines from apps AndroidManifest.xml
android:name="android.intent.category.LAUNCHER" />
and added below lines in SettingsActivity.java from Settings app.
if (KA_FRAGMENT.equals(fragmentName)) {
Intent kaIntent = new Intent();
kaIntent.setClassName("com.cyborg.manager", "com.cyborg.manager.activities.MainActivity");
startActivity(kaIntent);
finish();
return null;
}
Also added below lines in AndroidManifest.xml of Settings
<activity android:name="Settings$KActivity"
android:label="#string/hit_perform"
android:icon="#drawable/hit_performance_icon"
android:taskAffinity="" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.android.settings.SHORTCUT" />
</intent-filter>
<intent-filter android:priority="1">
<action android:name="com.android.settings.action.SETTINGS" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.urom" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.ka" />
</activity>
Although, it works fine when 3rd party app is visible in launcher
If you want to play with custom ROM I'd recommend getting familiar with Android fundamentals first.
What makes you activity shown by launcher is this <intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.android.settings.SHORTCUT" />
</intent-filter>
especially these two lines:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
so remove them and you are done.
I'm trying to use GCM to receive messages from our server when the user is not in the app.
The porblem is that the GcmListenerService doesn't seem to work whilst the registeration works just fine. Our server should be working just fine since we receive confirmation from the GCM server every time we send something from our server to GCM.
This is my manifest (only GCM section)
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="false"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="my.package.package"/>
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="my.package.package"/>
</intent-filter>
</receiver>
<service
android:name=".services.MyGcmListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
</intent-filter>
</service>
<service
android:name=".services.MyGcmRegisterationService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
and this is the simplified onMessageReceived
#Override
public void onMessageReceived(String from, Bundle data)
{
saveDataToDatabase(data);
dataReceivedNotification();
}
I managed to resolve this.
I had
<uses-permission android:name="com.google.android.c2dm.permission.SEND" />
Twice in the Android Manifest and I was missing
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
I succeed to add my app in the "share" button in the Android gallery, so if I click on it, my app will start. Can I choose which activity of my app to start?
Now it starts the "main" one. Here's my code in the main class:
.....
Intent intent = getIntent();
Bundle extras = intent.getExtras();
String action = intent.getAction();
// if this is from the share menu
if (Intent.ACTION_SEND.equals(action)) {
if (extras.containsKey(Intent.EXTRA_STREAM)) {
// Get resource path
}
}
And the manifest:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
In reality I succeed in opening a new activity immediately after the "main" starts but I'll prefer to directly open the right one.
Thanks
Put your intent filter under activity you want to start into your manifest
<activity android:name=".Theme"
android:label="MAIN">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Theme"
android:label="ActiVITY2">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
If you had two activities in your manifest file, say Main and MediaShare then it would look something like this:
<activity android:name="Main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="MediaShare" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
The android.intent.action.SEND action and android:mimeType="image/*" data should go with the activity you want to start when you share an image.
See the page on Receiving Content from Other Apps for more details.