Android AWS Security Credential Issue - java

I am having a problem integrating the AmazonS3PersonalFileStore demo app login into my App
I have set up my TVM and everything works fine on the demo app, it also runs correctly when I copy/paste the project and rename it.
The issue comes when I begin pasting my .javas from my main app into the pasted Demo app, now when I login, I get the error
Credential Problem!
AWS Credentials not configured correctly. Please review the README file.
the readme refers to project setup and the .properties file, all of which I did not touch
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.amazonaws.demo.personalfilestore"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".S3PersonalFileStore"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Login"></activity>
<activity android:name=".s3.S3BucketView"></activity>
<activity android:name=".s3.S3ObjectView"></activity>
<activity android:name=".s3.S3AddObjectView"></activity>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.MainMenu"
android:label="#string/main_menu" />
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.TripMain"
android:label="#string/trips"/>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.TripView"
android:label="#string/trip_view"/>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.DiagnosticsMain"
android:label="#string/diagnostics"/>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.DtcListView"
android:label="#string/dtcs"/>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.RpmComparison"
android:label="#string/rpm_distribution"/>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.UbiMain"
android:label="#string/ubi"/>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.UbiView"
android:label="#string/ubi_view"/>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.UsageMain"
android:label="#string/usage"/>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.EnvironmentalMain"
android:label="#string/environmental_main"/>
<activity
android:screenOrientation="portrait"
android:name="com.example.indrive.ComparisonMain"
android:label="#string/vehicle_comparison"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxx"/>
</application>
</manifest>
Although I have added new code, I am pretty sure that none of it is running, since none of my activities are being created
Update: I tried adding an EC2 role to the TVM Elastic Beanstalk with the same permissions as the IAM TVMUser, but the demo app wouldn't even work
Update 2: Tried a bunch of different IAM configurations for the TVM IAM User / Elastic Beanstalk, nothing worked

I had the same issue when integrating the AmazonS3PersonalFileStore demo app login into my app.
The problem was that the request to the TVM via the HTTP request was blocked. This is due to the android sdk's StrictMode.ThreadPolicy which does not allow network operations to execute on the UI thread.
This restriction can be changed, using:
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
Add the above code into your main activity's onCreate() method.
In addition, it is always recommended to move network operation off the UI thread, for example, using AsyncTask.
I am confident this will fix your problem.

Related

How to fix the default activity not found problem?

my problem is related to Android Studio.Whenever I try to run my app I get an error that says default activity not found.Please help me out,it's really important.Thank you in advance!
Just in case,I've got 2 classes: the first one is MainActivity,the second one is CatRepository
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.cats">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Try to replace <activity android:name=".ui.MainActivity"> by <activity android:name=".MainActivity">
Try putting full package name of your Activity.
You can try invalidating cache and restart.
File -> Invalidate Cache/Restart
Also after doing this, sync your project. : File-> Sync Project with Gradle Files

Java: Android App works on virtual device but crashes on real one

I'm working on fall detection app. I was testing it on virtual devices API: 23,28,29 and app works fine but when I run this app on my phones with Android 6 and 9 it crash
immediately.
What are the solutions ?
Thanks in Advance.
Run desription
I checked MainActivity line from errors window but i have no suggestion what I can do.
MainActivity line175
Logcat errors after open app: Logcat
My manifest
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.SEND_SMS"/>
<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"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_falling_down_stairs"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<receiver android:name=".MyLocationService"/>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
<activity android:name=".CaretakersList"></activity>
<activity android:name=".settingContact" />
<service
android:name=".AlertService"
android:enabled="true"
android:exported="true" />
<activity android:name=".MainActivity" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This is because DecimalFormat generate localized string, and the decimal separator can be different in some locale.
You can force the good locale like this :
DecimalFormat precision = new DecimalFormat("0.00", new DecimalFormatSymbols(Locale.US));
More info here
From your stacktrace there is error in Real number format in method of your MainACtivity onSensorChanged with value "9,35". In java all floating numbers use dot like this "9.35". Check this method and use correct format of Real number

Flurry integration Android throwing errors

I'm trying to integrate flurry into my android app. I'm using the recommended setting and have repositories{jcenter()} and
// Required for Flurry Analytics integration
compile 'com.flurry.android:analytics:8.2.0#aar'
// Optional - If you want to use the Ads SDK
compile 'com.flurry.android:ads:8.2.0#aar'
in the gradle as the docs suggest. I keep getting errors in the that Application is not resolved. The docs really blow and I'm not 100% sure what going on. I've never integrated flurry before can someone please help! I put the manifest and the class i'm using below. I know it doesn't have a key I'm still working on removing errors. I'm dumping the that class in the main file for simplicity for now.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tempconversion.october.com.myapplication">
<!-- Required permissions - Internet access -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- Highly Recommended permission - External memory pre-caching -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Optional permission - Location based ad targeting -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="F to C and K"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
class in main file
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
new FlurryAgent.Builder()
.withLogEnabled(true)
.withCaptureUncaughtExceptions(true)
.withContinueSessionMillis(10)
.withLogLevel(VERBOSE)
.build(this, FLURRY_API_KEY);
}
}
Declare the application name in manifest.xml file.
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="F to C and K"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

Broadcast Receiver not working when app is not running

My broadcast receiver does not work when the application is not running in the background.
Tried with different intent filters
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme.NoActionBar" >
<receiver android:name=".network.NetworkChangeReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<activity
android:name=".view.activity.MainActivity"
android:label="#string/app_name">
</activity>
<activity android:name=".view.activity.BarLoginActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
My receiver works fine when the app is running in the background but as soon as I remove my recent apps it does not work.
Running on API 19
Finally it worked in other android phones.
as broadcast receivers and services are by default not allowed in Xiaomi phones
I would try putting a android:process=":remote" in the Manifest definition of the receiver so that it will run on a separate task.
Haven't seen your entire AndroidManifest but my first suspect is that you're lacking the proper permission.
In order to listen to network changes you must declare that you are using this permission in the manifest like this
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
the next suspect is the name you gave, maybe try giving the full path to the reciever name

Registration Error :null in android

I have been implementing the code of login and registration app from http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
I copy pasted the code along with following the instructions but I am still getting the registration error : null in the log cat on pressing the register button.
The php files(ex: register.php) are displaying {"error":true,"error_msg":"Required parameters (name, email or password) is missing!"} , that means they are working fine.
I am using xampp and have kept the files in htdocs. I have checked various url in Appconfig.java such as 127.0.0.1, 10.0.2.2:8080, 10.0.2.2:80, and the ip of my computer system from ipconfig cmd, but still getting same error.
Here is the code of Appconfig.java.
package com.urjapawar.hackathon1;
public class AppConfig {
// Server user login url
public static String URL_LOGIN ="http://192.168.2.5/android_login_api/login.php";
// Server user register url
public static String URL_REGISTER = "http://192.168.2.5/android_login_api/register.php";
}
and here is the code of Android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.urjapawar.hackathon1" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="com.urjapawar.hackathon1.AppController"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name=".LoginActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop" />
<activity
android:name=".RegisterActivity"
android:label="#string/title_activity_register"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan" >
</activity>
</application>
Also I have checked correctly username and password in config.php, Please help.
I just need to replace 192.168.2.5 with 192.168.2.5:80

Categories

Resources