Below is my code snippet... There is no error, but the ad is not showing on the activity... I do not know what I am missing.. PLease HELP!
public class InMobiAdActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
IMAdView imAdView = new IMAdView(this, IMAdView.INMOBI_AD_UNIT_320X50,"4028cba631d63df10131e1d3818b00cc (code taken from inmobi wiki as sample code for testing ads");
LinearLayout layout = (LinearLayout)findViewById(R.id.ll);
layout.addView(imAdView);
IMAdRequest adRequest = new IMAdRequest();
adRequest.setTestMode(true);
imAdView.setIMAdRequest(adRequest);;
imAdView.loadNewAd();
}
}
On my Logcat it shows;
10-08 14:23:02.534: D/InMobiAndroidSDK_3.6.0(2388): requestactivity=AdRequest&u-rt=0&d-device-screen-density=1.5&d-device-screen-size=480X800&mk-siteid=4028cba631d63df10131e1d3818b00cc&u-id-map=fGtq8K%2F5btMGW7t0WElg0rMcqUSCfbWD8E%2FCvECMDB9eWL5VBtsR3k9awVDmgjD4BS024QxddQlU%0AmAdObyz5KA%3D%3D%0A&u-id-key=-1447871561&u-key-ver=1&aid=b281bb6c-ddd8-4ffe-bb5d-395be16b6607&mk-version=pr-SAND-DTGTA-20120915&mk-rel-version=pr-SAND-DTGTA-20120915&format=xhtml&mk-ads=1&h-user-agent=Mozilla%2F5.0+%28Linux%3B+U%3B+Android+2.3.3%3B+en-us%3B+sdk+Build%2FGRI34%29+AppleWebKit%2F533.1+%28KHTML%2C+like+Gecko%29+Version%2F4.0+Mobile+Safari%2F533.1&u-appBId=com.dtan.inmobi&u-appDNM=InMobiAndroidSDKSampleApp&u-appVer=1.0&d-localization=en_us&d-netType=umts&d-orientation=1&mk-ad-slot=15
10-08 14:23:02.684: I/ActivityManager(61): Displayed com.dtan.inmobi/.InMobiAdActivity: +1s472ms
EDIT:
Here is my Manifest. All the permissions are indicated here as well;
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dtan.inmobi"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".InMobiAdActivity"
android:label="title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.inmobi.androidsdk.IMBrowserActivity" android:configChanges="keyboardHidden|orientation|keyboard" />
</application>
</manifest>
Try below Post For Fixing Connect Internet To Emulator
Android Emulator is not connecting to internet
android emulator browser not connecting to internet
Find More Help From Google Here
if u find same problem try to check it real device with internet connectivity!
Related
I am trying to send crash reports to email but when my app crashes nothing happens. I tried messing around with configurations but i just kept getting errors (unknown member mostly, wth that is). Here's my code for the class.
#ReportsCrashes(
mailTo = "me#gmail.com")
public class MyApplication extends Application
{
#Override
public void onCreate() {
super.onCreate();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
My manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ghostdevelopment.ueni2"
android:versionCode="1"
android:versionName="1.0"
android:debuggable="true">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="25" />
<application
android:name="MyApplication"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:label="#string/app_name"
android:name="com.ghostdevelopment.ueni2.MainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="Ship Database"
android:name=".ShipInfo" />
</application>
</manifest>
According to your logcat it appears that your app has not included the ACRA library. You need to configure your build so that ACRA is included in your APK.
I am trying to write in file after android device boots. I have checked everything related to this topic here but none of them worked for me. My phone is Huawei Honor (H30-U10) and it's rooted. Android version 4.2.2. Here is my code:
AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="bog.ddrc.technicianmobile"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name="bog.ddrc.technicianmobile.App"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="bog.ddrc.technicianmobile.activities.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:enabled="true"
android:name="bog.ddrc.technicianmobile.StartTMServiceAtBootReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
</manifest>
StartTMServiceAtBootReceiver.java:
public class StartTMServiceAtBootReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
String data = "text";
File path = Environment.getExternalStorageDirectory();
File file = new File(path, "test.txt");
try {
OutputStream os = new FileOutputStream(file);
os.write(data.getBytes());
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Remove
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
from your <receiver> block.
After trying all of mentioned answers and tricks, I finally find why the code is not work in my phone. Some Android phones like "Huawei Honor 3C Android 4.2.2" have a Statup Manager menu in their settings and your app must be checked in the list. :)
I am trying to connection through SSH to my server using JSCH.
JSch jsch = new JSch();
jsch.setConfig("StrictHostKeyChecking", "no");
session = jsch.getSession(this.username, this.host, 22);
session.setPassword(this.password);
Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
this.session.connect();
The error arrives on the session.connect on the last line
12-10 00:21:35.696: W/System.err(30732): com.jcraft.jsch.JSchException: java.net.UnknownHostException: Unable to resolve host "android.widget.EditText{4257c438 VFED..CL .F....ID 219,0-849,117 #7f080008 app:id/host}": No address associated with hostname
I can successfuly reach my server with Google ConnectBot but not that way...
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" />
<application
android:debuggable="true"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.exemple.myapp.MainActivity"
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 android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
/>
</manifest>
Thanks in advance for your help !
If this.host is an Edit text then you have to call this.host.getText().toString() in jsch.getSession(). And the same for username and password, if they were Edit text objects, too.
I am successfully calling my first Activity from my AIR Native Extension, however, when I try to call the second one, I am getting the Permission Denial error (see logcat screenshot). I have tried everything I have found suggested on this site, so posting question.
02-12 15:43:22.430: I/ActivityManager(271): START {act=android.intent.action.RUN cmp=com.cno.android.map/.AddMarkerActivity (has extras) u=0} from pid 14173
02-12 15:43:22.440: W/ActivityManager(271): Permission Denial: starting Intent { act=android.intent.action.RUN cmp=com.cno.android.map/.AddMarkerActivity (has extras) } from ProcessRecord{4147a718 14173:air.TestAndroidExtension.debug/u0a75} (pid=14173, uid=10075) not exported from uid 10072
Here is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cno.android.map"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- End of copy. -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
<activity
android:name="com.cno.android.map.InitMapActivity"
android:label="#string/title_activity_init_map" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.cno.android.map.AddMarkerActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.RUN"/>
</intent-filter>
</activity>
</application>
Things to note:
I first tried AddMarkerActivity without any intent-filter defined. Not having ANY luck, I began experimenting with the RUN action. I have commented everything out in AddMarkerActivity except for one logcat message that says "HELLO" in the onCreate method. As you can see my Activity is not duplicated in the manifest and exported is set to true.
And finally, here is how I am calling the Activity:
public class AddAnnotationFunction implements FREFunction {
public static final String TAG = "AddAnnotationFunction";
public final static String EXTRA_MARKER = "com.cno.nativemap.functions.marker";
#Override
public FREObject call(FREContext context, FREObject[] args) {
Intent intent = new Intent();
intent.setClassName("com.cno.android.map", "com.cno.android.map.AddMarkerActivity");
Log.d(TAG, "Starting Map Activity- add marker");
intent.setAction("android.intent.action.RUN");
intent.putExtra(EXTRA_MARKER, new GeoMarker(args));
context.getActivity().startActivity(intent);
return null;
}
}
This is the error that shows on my logcat when i run my TagViewer.java for NFC on Eclipse. I am running a NFC program and basically it runs however at a certain period of time the program shuts down on its own.
08-29 14:06:33.677: E/ViewTag(22056): Unknown intent Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.android.nfc/.TagViewer }
This is from my Android Manifest. I am guessing that the error is from here because of the line on the error android.intent.action.MAIN and such.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.nfc"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-feature android:name="android.hardware.nfc" android:required="true"/>
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="16" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".TagViewer"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</intent-filter>
</activity>
</application>
</manifest>
this is from my java and basically the last line, when i put // the program will not shut down but it will show like a white page.However the title NFC is still showing so i know that it is slightly working
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTagContent = (LinearLayout) findViewById(R.id.tag_viewer);
mTitle = (TextView) findViewById(R.id.title);
resolveIntent(getIntent());
}
Change your Declaration activity "TagViewer" instead of ".TagViewer"