My app's service starts activity in LockScreen(android:showOnLockScreen="true" option in Manifests.xml).
The LockScreen activity sets onTouch listener.
In onTouch, it calls finish() to close activity
This finish() function incurs warning message 'requires android.permission.INTERACT_ACROSS_USERS'
How to solve it?
Following is Manifests.xml
<service android:name=".LockScreenService" />
<activity android:name=".LockScreenActivity"
android:showOnLockScreen="true"
android:launchMode="singleInstance"
android:theme="#style/AppThemeNoAction">
</activity>
Following is Lockscreen activity onTouch Source
#Override
public boolean onTouch(View v, MotionEvent event) {
finish()
}
Following is warning log
W/System.err: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=20053, uid=10216 requires android.permission.INTERACT_ACROSS_USERS
W/System.err: at android.os.Parcel.readException(Parcel.java:1958)
W/System.err: at android.os.Parcel.readException(Parcel.java:1904)
W/System.err: at android.sec.clipboard.IClipboardService$Stub$Proxy.isEnabled(IClipboardService.java:757)
W/System.err: at com.example.android.content.clipboard.SemClipboardManager.isEnabled(SemClipboardManager.java:1008)
W/System.err: at android.widget.TextView.getSecClipboardEnabled(TextView.java:16133)
W/System.err: at android.widget.TextView.onDetachedFromWindowInternal(TextView.java:7178)
W/System.err: at android.view.View.dispatchDetachedFromWindow(View.java:18645)
W/System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3878)
I/chatty: uid=10216(u0_a216) com.example.lockscreen identical 4 lines
W/System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3878)
W/System.err: at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:4001)
W/System.err: at android.view.ViewRootImpl.doDie(ViewRootImpl.java:7267)
W/System.err: at android.view.ViewRootImpl.die(ViewRootImpl.java:7244)
W/System.err: at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:483)
W/System.err: at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:421)
W/System.err: at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:131)
W/System.err: at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4643)
W/System.err: at android.app.ActivityThread.-wrap5(Unknown Source:0)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1757)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:105)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6938)
06-19 10:30:50.615 20053-20053/com.example.lockscreen W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
W/System.err: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=20053, uid=10216 requires android.permission.INTERACT_ACROSS_USERS
W/System.err: at android.os.Parcel.readException(Parcel.java:1958)
W/System.err: at android.os.Parcel.readException(Parcel.java:1904)
W/System.err: at android.sec.clipboard.IClipboardService$Stub$Proxy.isEnabled(IClipboardService.java:757)
W/System.err: at com.example.android.content.clipboard.SemClipboardManager.isEnabled(SemClipboardManager.java:1008)
W/System.err: at android.widget.TextView.getSecClipboardEnabled(TextView.java:16133)
W/System.err: at android.widget.TextView.onDetachedFromWindowInternal(TextView.java:7178)
W/System.err: at android.view.View.dispatchDetachedFromWindow(View.java:18645)
W/System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3878)
I/chatty: uid=10216(u0_a216) com.example.lockscreen identical 4 lines
W/System.err: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3878)
W/System.err: at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:4001)
W/System.err: at android.view.ViewRootImpl.doDie(ViewRootImpl.java:7267)
W/System.err: at android.view.ViewRootImpl.die(ViewRootImpl.java:7244)
W/System.err: at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:483)
W/System.err: at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:421)
W/System.err: at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:131)
W/System.err: at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4643)
W/System.err: at android.app.ActivityThread.-wrap5(Unknown Source:0)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1757)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:105)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6938)
06-19 10:30:50.617 20053-20053/com.example.lockscreen W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
D/ViewRootImpl#bee7239[LockScreenActivity]: dispatchDetachedFromWindow
D/InputEventReceiver: channel '7c33270 com.example.lockscreen/com.example.lockscreen.LockScreenActivity (client)' ~ Disposing input event receiver.
D/InputEventReceiver: channel '7c33270 com.example.lockscreen/com.example.lockscreen.LockScreenActivity (client)' ~NativeInputEventReceiver.
Higher than target API 23 versions, the application gets permission with popup-window. Did you get a permission with popup-window?
EDIT:
You can use checkSelfPermission() and requestPermissions() to check permission or get permission.
Related
I am integrating the Intercom plugin for an existing Ionic 5 application following the instructions here: https://ionicframework.com/docs/native/intercom. Everything works great iOS, but when I start the application in an android simulator, the following exception is thrown and the app terminates.
I am fairly new to android studio/java, so any advice would be greatly appreciated.
D/Capacitor: Starting BridgeActivity
W/System.err: java.lang.ClassNotFoundException: io.intercom.android.sdk.IntercomBridge
W/System.err: at java.lang.Class.classForName(Native Method)
W/System.err: at java.lang.Class.forName(Class.java:454)
W/System.err: at java.lang.Class.forName(Class.java:379)
W/System.err: at org.apache.cordova.PluginManager.instantiatePlugin(PluginManager.java:564)
W/System.err: at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:183)
W/System.err: at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:108)
W/System.err: at org.apache.cordova.PluginManager.init(PluginManager.java:96)
W/System.err: at com.getcapacitor.cordova.MockCordovaWebViewImpl.init(MockCordovaWebViewImpl.java:58)
W/System.err: at com.getcapacitor.Bridge$Builder.create(Bridge.java:1303)
W/System.err: at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:72)
W/System.err: at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:58)
W/System.err: at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:41)
W/System.err: at com.rkkn.driversseatcoop2.MainActivity.onCreate(MainActivity.java:15)
W/System.err: at android.app.Activity.performCreate(Activity.java:8054)
W/System.err: at android.app.Activity.performCreate(Activity.java:8034)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3666)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3842)
W/System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
W/System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
W/System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err: at android.os.Looper.loopOnce(Looper.java:201)
W/System.err: at android.os.Looper.loop(Looper.java:288)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7842)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "io.intercom.android.sdk.IntercomBridge" on path: DexPathList[[zip file
dd
[1]: https://ionicframework.com/docs/v5/native/intercom
I am having two applications, let A and B. There is ContentProvider in A, with manifest declaration as follows,
<provider
android:name=".LogProvider"
android:authorities="com.xxx.LogProvider"
android:grantUriPermissions="true"
android:permission="android.permission.READ_XXX_LOGS"
android:enabled="true"
android:exported="true"
android:multiprocess="true"/>
Application B is receiving ContentResolver for the same. And App B have corresponding also. But, whenever there is an Entry to content provider in App A,
App B is receiving its onChange event. But, is having the following error.
I/XTSipListener: onChange, uri = content://com.xxx.LogProvider/error_logs/1
E/XTSipListener: onChange, SecurityException: Permission Denial: opening provider com.xxx.LogProvider from ProcessRecord{bb1084b 22087:com.xxx.AppB/u0a210} (pid=22087, uid=10210) requires android.permission.READ_XXX_LOGS or android.permission.READ_XXX_LOGS
W/System.err: java.lang.SecurityException: Permission Denial: opening provider com.xxx.LogProvider from ProcessRecord{bb1084b 22087:com.xxx.AppB/u0a210} (pid=22087, uid=10210) requires android.permission.READ_XXX_LOGS or android.permission.READ_XXX_LOGS
W/System.err: at android.os.Parcel.readException(Parcel.java:1712)
W/System.err: at android.os.Parcel.readException(Parcel.java:1662)
W/System.err: at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:4935)
W/System.err: at android.app.ActivityThread.acquireProvider(ActivityThread.java:6083)
W/System.err: at android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:2468)
W/System.err: at android.content.ContentResolver.acquireProvider(ContentResolver.java:1476)
W/System.err: at android.content.ContentResolver.acquireContentProviderClient(ContentResolver.java:1551)
W/System.err: at com.xxx.AppB.contentobservers.XTSipListener.onChange(XTSipListener.java:86)
W/System.err: at android.database.ContentObserver.onChange(ContentObserver.java:145)
W/System.err: at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:216)
W/System.err: at android.os.Handler.handleCallback(Handler.java:751)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err: at android.os.Looper.loop(Looper.java:154)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6816)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
E/XTSipListener: onChange: cur = NULL
AppB have target version 22. Which cant be upgraded due to some other functionalities.
My Android app does not work on https call at First Run After Installation.
And then restart app after https call is fine. Only First Run After Installation does not working.
My App use multiple network class Socket(for tcp/ip), Http wrapped class(HttpClient, HttpGet)
**Error Log -----------------------------------------------**
D/InputTransport: Input channel destroyed: fd=91
I/SemDesktopModeManager: unregisterListener: android.view.ViewRootImpl$3#b979a69
I/System.out: AsyncTask #2 calls detatch()
W/System.err: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
W/System.err: at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:368)
W/System.err: at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:406)
W/System.err: at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:219)
W/System.err: at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:172)
W/System.err: at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:130)
W/System.err: at org.apache.http.impl.client.DefaultRequestDirector.executeOriginal(DefaultRequestDirector.java:1334)
W/System.err: at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:700)
W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:560)
W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:658)
W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:632)
W/System.err: at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:621)
W/System.err: at com.yuanta.mainlib.view.alarm.EventHttpProcessor$NoticeAsyncTask.doInBackground(EventHttpProcessor.java:63)
W/System.err: at com.yuanta.mainlib.view.alarm.EventHttpProcessor$NoticeAsyncTask.doInBackground(EventHttpProcessor.java:51)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:304)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
W/System.err: at java.lang.Thread.run(Thread.java:762)
W/System.err: Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path
W/System.err: at com.android.org.conscrypt.TrustManagerImpl.verifyChain(TrustManagerImpl.java:546)
W/System.err: at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:427)
W/System.err: at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:491)
W/System.err: at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:491)
W/System.err: at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:387)
W/System.err: at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:361)
W/System.err: at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:290)
W/System.err: at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
W/System.err: at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:88)
W/System.err: at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:178)
W/System.err: at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:617)
W/System.err: at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
W/System.err: at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:364)
W/System.err: ... 18 more
W/System.err: Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
W/System.err: ... 31 more
I/System.out: Thread-2620(ApacheHTTPLog):isSBSettingEnabled false
I/System.out: Thread-2620(ApacheHTTPLog):isShipBuild true
I/System.out: Thread-2620(ApacheHTTPLog):getDebugLevel 0x4f4c
I/System.out: Thread-2620(ApacheHTTPLog):Smart Bonding Setting is false
Did you add these in your manifest?
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I'm having trouble connecting Android studio emulator to Internet behind proxy.
I have enabled permission in android Manifest.xml
<uses-permission android:name="android.permission.INTERNET" />
And the app works perfectly well in USB Debug mode.
This is the error i get when i run the app on Emulator.
Following is my Logcat .
D/makeGitHubSearchQuery: Inside Function
D/makeGitHubSearchQuery: HTTP
D/makeGitHubSearchQuery: https://api.github.com/search/repositories?q=HTTP&sort=stars
D/OnOptionsItemSelected: action_search
W/System.err: java.net.UnknownHostException: Unable to resolve host "api.github.com": No address associated with hostname
W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:470)
W/System.err: at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
W/System.err: at java.net.InetAddress.getAllByName(InetAddress.java:215)
W/System.err: at com.android.okhttp.internal.Network$1.resolveInetAddresses(Network.java:29)
W/System.err: at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:188)
W/System.err: at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:157)
W/System.err: at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:100)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.createNextConnection(HttpEngine.java:357)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:340)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:384)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:231)
W/System.err: at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
W/System.err: at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java)
W/System.err: at com.example.android.datafrominternet.utilities.NetworkUtils.getResponseFromHttpUrl(NetworkUtils.java:76)
W/System.err: at com.example.android.datafrominternet.MainActivity$GithubQueryTask.doInBackground(MainActivity.java:77)
W/System.err: at com.example.android.datafrominternet.MainActivity$GithubQueryTask.doInBackground(MainActivity.java:71)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:295)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
W/System.err: at java.lang.Thread.run(Thread.java:818)
W/System.err: Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
W/System.err: at libcore.io.Posix.android_getaddrinfo(Native Method)
W/System.err: at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
Please guide me in setting the Proxy settings in Android emulator.
Use this command to open emulator with the desired proxy.
emulator -avd [emulator_name] -http-proxy [proxy ip address]:[port]
official docs
I have a simple code and there is an exception coming, can't figure out why?
My code:
Document document= Jsoup.connect("https://kolkatatrafficpolice.net/").get();
Stack trace:
javax.net.ssl.SSLHandshakeException: Connection closed by peer
W/System.err: at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
W/System.err: at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:357)
W/System.err: at com.android.okhttp.Connection.connectTls(Connection.java:235)
W/System.err: at com.android.okhttp.Connection.connectSocket(Connection.java:199)
W/System.err: at com.android.okhttp.Connection.connect(Connection.java:172)
W/System.err: at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:367)
W/System.err: at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:130)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:247)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:457)
W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:126)
W/System.err: at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:89)
W/System.err: at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java)
W/System.err: at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:571)
W/System.err: at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:548)
W/System.err: at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:235)
W/System.err: at org.jsoup.helper.HttpConnection.get(HttpConnection.java:224)
W/System.err: at com.pritesh.trafficviolation.GetHtml.doInBackground(MainActivity.java:29)
That server is using an unrecognized certificate authority.
If this is your server, and you are intentionally doing this (e.g., this is a self-signed certificate), you would need to configure JSoup/OkHttp to use that self-signed certificate.
Otherwise, your problems lie with the server.