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.
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 have this exception in my app, under warnings in the Logcat.
The app is a system app.
java.lang.reflect.InvocationTargetException
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at netchanger.tawkon.com.lib.network.NetworkChanger.setPreferredNetwork(NetworkChanger.java:48)
W/System.err: at netchanger.tawkon.com.lib.network.NetworkChanger.setPreferredNetwork(NetworkChanger.java:36)
W/System.err: at netchanger.tawkon.com.lib.services.LocationMonitorService.stopService(LocationMonitorService.java:57)
W/System.err: at com.tawkon.data.lib.service.KeepAliveService$PowerReceiver.onReceive(KeepAliveService.java:154)
W/System.err: at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52497(LoadedApk.java:1313)
W/System.err: at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
W/System.err: at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
W/System.err: at android.os.Handler.handleCallback(Handler.java:790)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
W/System.err: Caused by: java.lang.SecurityException: No Carrier Privilege.
W/System.err: at android.os.Parcel.readException(Parcel.java:2005)
W/System.err: at android.os.Parcel.readException(Parcel.java:1951)
W/System.err: at com.android.internal.telephony.ITelephony$Stub$Proxy.setPreferredNetworkType(ITelephony.java:4237)
W/System.err: at android.telephony.TelephonyManager.setPreferredNetworkType(TelephonyManager.java:4821)
W/System.err: ... 15 more
I see that this is InvocationTargetException and it's caused by SecurityException.
What does 'No Carrier Privilege.' mean? How can I avoid this?
Security Exception implies there is a permission required to which the user hasn't granted. Ensure you request for the correct permission and confirm that the user has granted the permission before execution of the functionality.
Read on telephony manager
As per the android documentation in order to use android.telephony.TelephonyManager.setPreferredNetworkType() method your app should have carrier privileges.
Carrier Privileges in a gist:
Android grants special privileges to apps from Mobile (Virtual) Network Operator (MNO/MVNOs) via UICC to override certain carrier configurations (e.g. IMS settings) on the device. This app from operator is signed with a signing key whose hash value is stored in UICC, which is in-turn read by Android Platform to allow the app to make calls to handful of special APIs
More information related to how to give your app carrier privileges can be found here. The link explains the method to override IMS settings using carrier privileges but it can be applied to whatever functionality you are trying to achieve
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.
When attempting to run the BLE Indoor Positioning Demo App on Android Things (using the NXP i.MX7D Developer Kit), I get Bluetooth scanning error: Location Services disabled (code 4).
E/BluetoothClient: Bluetooth scanning error: Location Services disabled (code 4)
W/System.err: com.polidea.rxandroidble.exceptions.BleScanException: Location Services disabled (code 4)
W/System.err: at com.polidea.rxandroidble.internal.scan.ScanPreconditionsVerifierApi18.verify(ScanPreconditionsVerifierApi18.java:31)
W/System.err: at com.polidea.rxandroidble.internal.scan.ScanPreconditionsVerifierApi24.verify(ScanPreconditionsVerifierApi24.java:38)
W/System.err: at com.polidea.rxandroidble.RxBleClientImpl$1.call(RxBleClientImpl.java:114)
W/System.err: at com.polidea.rxandroidble.RxBleClientImpl$1.call(RxBleClientImpl.java:111)
W/System.err: at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
W/System.err: at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)
W/System.err: at rx.Observable.subscribe(Observable.java:10352)
W/System.err: at rx.Observable.subscribe(Observable.java:10319)
W/System.err: at rx.Observable.subscribe(Observable.java:10227)
W/System.err: at com.nexenio.bleindoorpositioningdemo.bluetooth.BluetoothClient.startScanning(BluetoothClient.java:79)
W/System.err: at com.nexenio.bleindoorpositioningdemo.HomeActivity.onResume(HomeActivity.java:108)
W/System.err: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1355)
W/System.err: at android.app.Activity.performResume(Activity.java:7118)
W/System.err: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556)
W/System.err: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
W/System.err: at android.app.ActivityThread.-wrap11(Unknown Source:0)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
The app uses RxAndroidBle for dealing with Android's Bluetooth stack. It also declares these permission in the manifest:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
As of my understanding, Android Things should automatically grant these permissions at install time or after a reboot.
I don't know how I should enable the location services manually or programatically.
The issue is not with permissions. The RxAndroidBle library makes some assumptions about location services that aren't necessarily appropriate for Android Things (since those settings aren't actually controlled by users). The reason the library check is failing is because NETWORK_PROVIDER is not enabled and GPS_PROVIDER is only enabled if you have a GPS driver registered. You don't actually need either of those to do a BLE scan, however.
Fortunately for you, it looks like the author of RxAndroidBle recently changed the code to also verify if the location mode settings were enabled. This check will pass on Android Things, so in your case you probably only need to update your library dependency to 1.5:
dependencies {
...
implementation "com.polidea.rxandroidble:rxandroidble:1.5.0"
}
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" />