How to upload an image to Amazon s3 bucket using Java in Android? -


i trying upload image took camera s3 bucket.

cognitocachingcredentialsprovider credentialsprovider = new cognitocachingcredentialsprovider( getapplicationcontext(), "us-west-2:xxxxxxxxxxxxx", regions.us_west_2 );   amazons3client s3client = new amazons3client(new awscredentials() {         @override         public string getawsaccesskeyid() {             return "xxxxxxx";         }          @override         public string getawssecretkey() {             return "xxxxxxx";         }     });       transferutility transferutility = new transferutility(s3client,getapplicationcontext());  transferutility.upload(my_bucket,file.getname(),file); 

my pool in us-west-2 bucket region in asia pacific sydney.

running above code crashes , gives me error below.

java.lang.runtimeexception: error receiving broadcast intent { act=android.net.conn.connectivity_change flg=0x4000010 (has extras) } in com.amazonaws.mobileconnectors.s3.transferutility.transferservice$networkinforeceiver@744215                                                                                  @ android.app.loadedapk$receiverdispatcher$args.lambda$-android_app_loadedapk$receiverdispatcher$args_50043(loadedapk.java:1282)                                                                                  @ android.app.-$lambda$filbqgnxjrn9mgyks1xheaxzstk.$m$0(unknown source:4)                                                                                  @ android.app.-$lambda$filbqgnxjrn9mgyks1xheaxzstk.run(unknown source:0)                                                                                  @ android.os.handler.handlecallback(handler.java:769)                                                                                  @ android.os.handler.dispatchmessage(handler.java:98)                                                                                  @ android.os.looper.loop(looper.java:164)                                                                                  @ android.app.activitythread.main(activitythread.java:6540)                                                                                  @ java.lang.reflect.method.invoke(native method)                                                                                  @ com.android.internal.os.zygote$methodandargscaller.run(zygote.java:240)                                                                                  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:767)                                                                               caused by: java.lang.securityexception: connectivityservice: neither user 10084 nor current process has android.permission.access_network_state.                                                                                  @ android.os.parcel.readexception(parcel.java:1948) 

i have added permissons , services in manifest file. how can fix , send image s3 bucket in asia pacific sydney.

i have these permissions under manifest file -

   <uses-permission android:name="android.permission.internet"></uses-permission> <uses-permission android:name="android.permission.access_network_state" /> 

as error states, need add android.permission.access_network_state permission in manifest


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -